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 k开发者_JS百科now how to generate it dynamically whenever player climbs up.
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.
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)
精彩评论