I’m having a problem with the automatic texture coordinate generation. The x and y directions are fine I’m just having a problem with getting the next slices.
Here’s the code I use for generating the texture coordinates.
static GLfloat splane[4] = {-1.f/(float)(Wslices2), 0.f, 0.f, .5f};
static GLfloat tplane[4] = {0, -1.f/(float)(Hslices2), 0, .5f};
static GLfloat rplane[4] = {0, 0, 1.f/(float)(Dslices*2), 0.5f};
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, splane);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tplane);
glTexGenfv(GL_R, GL_OBJECT_PLANE, rplane);
Here was the code before the auto gen:
for(int i = 0; i < Dslices; i++)
{
glBegin(GL_QUADS);
glTexCoord3f(1.0f, 1.0f, (float)i/(float)(Dslices-1));
glVertex3f(-widcoord, -htcoord, -(depthcoordDslices)/2);
glTexCoord3f(1.0f, 0.0f, (float)i/(float)(Dslices-1));
glVertex3f(-widcoord, htcoord, -(depthcoordDslices)/2);
glTexCoord3f(0.0f, 0.0f, (float)i/(float)(Dslices-1));
glVertex3f(widcoord, htcoord, -(depthcoordDslices)/2);
glTexCoord3f(0.0f, 1.0f, (float)i/(float)(Dslices-1));
glVertex3f(widcoord, -htcoord, -(depthcoordDslices)/2);
glEnd();
}
[This message has been edited by DarthPaul (edited 07-03-2002).]
[This message has been edited by DarthPaul (edited 07-03-2002).]