Hi,
in my MacOS X application, I’m using spherical environment mapping to simulate reflections on water and to create a chrome effect. So far, it seemed to work well, but some user who uses a GeForce FX 5200 graphics card reproted that the water reflections wouldn’t work while the chrome effect seems to be ok.
Somehow the texture coordinates for the water aren’t generated and openGL uses the ones supplied with the vertex data instead.
Is there any difference in the way ATI and Nvidia cards handle spherical mapping?
There isn’t any major difference between the code for the chrome effect, that always works, and the code for the water reflection. Both use single triangles.
Is there any common mistake I could have made that would cause spherical environment mapping to only work on certain cards?
Thanks in advance
Here’s the code I use to render the water:
glDisable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D, g.envTexID);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glBegin(GL_TRIANGLES);
for(x1 = xstart; x1 < xend; x1 += xStep){
x2 = x1 + xStep;
for(z1 = zstart; z1 < zend; z1 += zStep){
z2 = z1 + zStep;
/* draw the triangles */
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(x1, 0, z1);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(x1, 0, z2);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(x2, 0, z2);
/* 2nd tri */
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(x1, 0, z1);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(x2, 0, z2);
glNormal3f(0.0f, 1.0f, 0.0f); /* 4th vertex */
glTexCoord2f(1.0f, 0.0f);
glVertex3f(x2, 0, z1);
}
}
glEnd();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glEnable(GL_LIGHTING);