PDA

View Full Version : TEXTURE_3D Help



Zodiac
01-26-2005, 09:28 AM
Hi!

I'm trying to use a 3D texture for blending, so I upload four textures into the 3D Texture.

I would assume that I could use the third texture coordinate to switch between the different layers in the 3D texture. For instance if I wanted to use the first layer the third texture coordinate value would be 0.0f, and if wanted to use the last layer the coordinate would 1.0f is that not possible??? Or did I really miss something here. :confused:

endash
01-26-2005, 10:05 AM
That's how it works.

Zodiac
01-26-2005, 10:10 AM
That is pretty odd then. I'm using vertex arrays, but i also just wrote a small immediate mode test program like this:

glBegin(GL_QUADS);
glTexCoord3f(0,0,0);
glVertex3f(0,0,0);
glTexCoord3f(0,1,0);
glVertex3f(0,0,1000);
glTexCoord3f(1,1,0);
glVertex3f(1000,0,1000);
glTexCoord3f(1,0,0);
glVertex3f(1000,0,0);
glEnd();

So this should give me the first texture right?
But I'm actually getting the last? Any ideas why?

Matt Zamborsky
01-26-2005, 12:34 PM
do you bind the texture with GL_TEXTURE_3D ?

endash
01-26-2005, 03:11 PM
For the behavior you want, I think you want to be clamping to the edge. If the texture is set to repeat, z=0 will be a blend between the top and bottom planes, I think.

Ffelagund
01-27-2005, 01:46 AM
Maybe you've set a texture matrix that are changing your texcoords. Try loading the identity to the texture matrix.