PDA

View Full Version : Generating Textures ( a little buggy )



barsanpipu
04-30-2002, 04:37 AM
What i'm trying to do is have OpenGL generate textcoords for my 3D Objects. I've enabled the texture autogeneration and it works but it's just that is only ONE image but OpenGL generates thousands of them, so i have to rescale the texture in order to get the right effect.
I wonder if I cand have OGL generate the correct textures coords directly, without having to rescale the texture.

I'm texturing ASC objects that are quite complex and concave. I do not want to use the texture coords imported from 3DSMAx, don't ask why.
thanks for your help,
Clau

Deiussum
04-30-2002, 05:58 AM
You can have OpenGL generate texcoords for you, but you will have limited control over them. You simply have to glEnable GL_TEXTURE_GEN_Q, GL_TEXTURE_GEN_R, GL_TEXTURE_GEN_S, G_TEXTURE_GEN_T. (Usually you won't enable all of them, just the ones you use for the TexGen method you use.)

You can use glTexGen* to specify the function to use, and glTexGen*v to specify different coefficents on the functions used.

An example..


From MSDN...

If the texture generation function is GL_OBJECT_LINEAR, the function

g = p1x0 + p2y0 + p3z0 +p4w0

is used, where g is the value computed for the coordinate named in coord; p1, p2, p3, and p4 are the four values supplied in params; and xo, yo, zo, and wo are the object coordinates of the vertex.