PDA

View Full Version : Automatic Texture Coordinates Generation



Swan
03-24-2000, 04:54 AM
I have two questions about Automatic Texture Coordinates Generation:

1. - I have to draw textured 3D Models which consist of triangles, so I must store both S and T texture coordinates for each one of these triangles. When my program starts, calculates these S and T coordinates by means of one method of my own invention, but I'm not very happy with this "method". Does it exist any documented or well-working method to calculate the S and T coordinates for each triangle of a 3D model ?
(Maybe) Is it possible to use manual texture coordinates to texturize the triangles ?

2. - Due to the use of automatic texture coordinates, before draw each one of the triangles of my 3D model, I must set their texture coordinates:

glTexGenfv(GL_S, GL_OBJECT_PLANE, Face->S);
glTexGenfv(GL_T, GL_OBJECT_PLANE, Face->T);

The problem is that the "glTexEnv*" command cannot be used between calls to glBegin() and glEnd(), so I have to make a call to glBegin(GL_TRIANGLES) for each one of the triangles of the 3D model, instead of make only a call to glBegin(GL_TRIANGLES) for all the whole 3D model.
This makes my program slower.

Thanks you for read my message, and if you can help me, thanks again.

...and sorry for my english.