PDA

View Full Version : Cube reflections



M/\dm/\n
02-02-2004, 10:43 AM
Is it normal, that reflections from cube map on sphere are moving when I set gluLookAt?




gluLookAt(...);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, MountainsCM.id);
glColor4f(1,1,1,1);
glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGenf(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE _WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE _WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE _WRAP_R,GL_CLAMP_TO_EDGE);
if(plmin)
{
glFrontFace(GL_CW);
glPushMatrix();
glTranslatef(2,2,0);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glutSolidTeapot(1);
glPopMatrix();
glFrontFace(GL_CCW);
}
else
{
glPushMatrix();
glTranslatef(2,2,0);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glutSolidSphere(1,200,200);
glPopMatrix();
}
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);

If it's not OK, then wher's the prob http://www.opengl.org/discussion_boards/ubb/frown.gif

02-02-2004, 04:59 PM
Do you mean continuous movement, or that the reflection changes when the viewpoint changes?

M/\dm/\n
02-03-2004, 12:23 AM
My bad http://www.opengl.org/discussion_boards/ubb/frown.gif I meant when position is fixed, but view and up vector changes...

Like:
gluLookAt(const float px, const float py, const float pz,
variable float lx, variable float ly, variable float lz,
variable float ux, variable float uy, variable float uz);