PDA

View Full Version : Can I reverse the GL texture coordinate system?


ChrisD
2002.08.03, 06:46 PM
Can I reverse the GL texture coordinate system?

Basically the textures 0,0 seems to be different from that of RAVE...
So... every texture is upside down :-)

Is there an easy way to reverse this like it was to set the left hand coordinate system
for the view/projection matrix?

Maybe do somthing to the texturematrix(?) I think there is one?

Jeff Binder
2002.08.03, 08:15 PM
You could use the texture matrix, which works just like the others (set the matrix to GL_TEXTURE). Ylthough you'll have a performance penalty if this matrix is not set to identity, so that's not an optimal solution. You can also flip all all of your 't' texture coordinates. Finally, you could just flip the images as you load them, which shouldn't be too difficult, depending on how you load them.

henryj
2002.08.04, 05:25 PM
Remember that everything in opengl has the origin bottom left. So if your using quicktime or similar to load your textures you need to do a flip. It's best to do this at load time, then you don't have to worry about it. If you need to know how to do this post another message.

ChrisD
2002.08.04, 05:47 PM
Originally posted by henryj
Remember that everything in opengl has the origin bottom left. So if your using quicktime or similar to load your textures you need to do a flip. It's best to do this at load time, then you don't have to worry about it. If you need to know how to do this post another message.

Im useing glpng.c open source code for loading PNGs into GL textures.

Now I could modify that to do the flip for me...
Which will probably be a pain.

Or do you have better solution?
can you get GL to flip the texture for you after you load it from the file?

inio
2002.08.04, 11:55 PM
how hard would it be to just do 1-coord.y whever you use the y-coord? If your rendering code is written right, that should only be a couple places.