views:

52

answers:

2

Hi,

I was wondering how to create wall in opengl and it is continuously appears from up and disappers at down screen. I am able to construct wall by GL_QUADS with texture mapping. but do not know how to generate it dynamically whenever player climbs up.

A: 

You don't have to make a "dynamic wall" (et. change glVertex* values every frame). Just change your camera position (modelview matrix) with glTranslatef function.

(I hope I understood your question correctly)

PiN
+1  A: 

You have several possibilities.

  • Create one quad for, say, one meter. Render it 100 times, from floor(playerPos.z) to 100 meters ahead. Repeat for the opposite wall
  • Create one quad for 100 meters. Set the U texture coordinate of the quad to playerPos.z and playerPos.z + 100. Set the texture mapping to GL_REPEAT.

The second one is faster (only 2 quads) but doesn't let you choose different textures for different parts of the wall.

Calvin1602
Great... I think I will go for first option. As I need to use different tectures.. Thanks.
OliveOne