Original Post
Hi,
I''m using cube mapping to reflect the skybox on a water surface. It works OK, but the reflection rotates with the camera, so if there is a mountain behind the camera it will reflect in the water in front of the player, but if the camera rotates 90 degrees to the left, the mountain will still be reflected in front of it, instead of to the right of it.
Here is my code:
//use cube environment mapping glPushMatrix(); sky->getCubemap()->Bind(); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); glMatrixMode(GL_TEXTURE); glPushMatrix(); glEnable(GL_TEXTURE_CUBE_MAP_EXT); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); glEnable(GL_NORMALIZE); drawHeightmap(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix();I believe I need to be rotating the texture matrix by the camera''s current rotation (I am using gluLookAt, so I''m not sure how to do this) after the second call to glPushMatrix. Its just a guess though. Any ideas? The water heightmap is rotating properly, its just the skybox reflection that won''t move. Thanks!