PDA

View Full Version : 3D Textures and Transformation



Chalnoth
11-05-2002, 04:13 AM
Well, I thought this might be a driver bug, but I suppose there just may be something I'm not initializing.

Quite simply, when I use the texture matrix to generate coordinates, the "r" texture coordinate (corresponding to the z position coord) always ends up zero. This is essentially all of my code related to texture coordinate generation:



glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScaled(0.5, 0.5, 0.5);
glTranslated(1.0, 1.0, 1.0);
glRotated(alpha, 1.0, 0.0, 0.0);
glRotated(beta, 0.0, 1.0, 0.0);
glRotated(gamma, 0.0, 0.0, 1.0);

Btw, when I generated the texture coordinates myself, essentially manually doing the exact same things the OpenGL specs say the above is supposed to do, it works great. It's just when attempting to use the texture transform matrix that I end up with nothing but 0's for my r coord.

[This message has been edited by Chalnoth (edited 11-05-2002).]

Tom Nuydens
11-05-2002, 04:35 AM
Which TexGen mode are you using? Did you correctly specify all three object or eye planes?

-- Tom

Chalnoth
11-05-2002, 05:39 AM
Essentially all of the TexGen code that I used is right there. So, I guess I also, then, need to specify the object or eye planes? I imagine all I want is for the R plane to be identical to the default S,T planes, then...so what is the default for the S,T planes?

davepermen
11-05-2002, 07:46 AM
RTFM?
s = 1,0,0,0
t = 0,1,0,0
r = 0,0,0,0
q = 0,0,1,0
i think it was like that (from brain..)
but you can read it up yourself..

i think it would explain why you have funny messy things.. at least its not an identity matrix..

Chalnoth
11-05-2002, 02:20 PM
You mean, that's the matrix that is instantiated instead of the identity when I call LoadIdentity? That would be a bit odd...

And, do you know exactly where I can read up on it? I had a hard time picking the GL specs for this information...

[This message has been edited by Chalnoth (edited 11-05-2002).]

Chalnoth
11-05-2002, 02:36 PM
Never mind, I got it. Just had to set the object planes. Thanks for the help.