View Full Version : Automatic texture coordinate generation

12-06-2002, 03:49 PM
The redbook says that glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR)will make the texture move with the object. (I do this for GL_T also).

So I am wondering how opengl knows how the object has transformed? Does this mean that any glTranslate, glRotate, glScale commands I do AFTER I enable with glEnable(GL_TEXTURE_GEN_S) are treated as the object transforming until I glDisable(GL_TEXTURE_GEN_S) it again?

In other words, where do I put this in the code so it doesn't affect everything else?


12-06-2002, 04:03 PM
OpenGL uses the vertex after modelview transformation to generate texture coordinates. Do your modelview transformations as usual, and enable texture coordinate generation when needed.

12-07-2002, 07:17 PM
OK, I thought when I put GL_OBJECT_PLANE instead of GL_OBJECT_LINEAR, that meant that the plane was defined in world coordinates instead of the object's coordinates. I guess the plane is ALWAYS in local coordinates?

So is this correct thinking then?...
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR) just tells opengl that I want to generate texture coordinates local to that object. And glTexGenfv(GL_S, GL_OBJECT_PLANE, plane) tells opengl that I want to use a plane which I specify.