Looking at some refresh code I inherited. Works with GL_QUADS which I want to replace with GL_TRIANGLE. First however I have to understand what’s going on.
The programmer is applying a texture to a 3D model (glTexImage3d). Iterating for(i=0;i<nslices;i++) The texture is 3D data we are displaying in an OpenGL visualizer.
Am I to assume that if a glVertex3f command follows a glTexCoord3f then that location in the texture is associated with that location in the model? So specifying four end coordinates in sequence it defines the outer points of the quad? This is repeated for each and every plane in the z direction.
z3=((float) i)/(nslices-1.0f)*2.0f-1.0f;
z4=1.0f-((float) i)/(nslices-1.0f);
glTexCoord3f (0.0f,0.0f,z4);
glVertex3f (-1.0f, -1.25f,z3);
glTexCoord3f (1.0f, 0.0f,z4);
glVertex3f (1.0f, -1.25f,z3);
glTexCoord3f (1.0f, 1.0f,z4);
glVertex3f (1.0f, 1.25f,z3);
glTexCoord3f (0.0f, 1.0f,z4);
glVertex3f (-1.0f, 1.25f,z3);