Jump to content
  • Advertisement
Sign in to follow this  
rick_appleton

OpenGL The order of texture data

This topic is 5394 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So far I've always used NeHe's TGA loading code to load my images and that has worked pretty well. However, I recently added .PNG support to my programs, and I came across the fact that .TGA files can be inverted. After lots of testing and fiddling, I now have both formats always working. However; I have to flip the rows of the .PNG data around so that the data that was read in last, is now on the first row, and vice versa. If I don't do this, the texture is mapped upside down. So I found out, that I don't actually know in which order OpenGL expects the texturedata to be provided to it. The first pixel data you give, is that top left, or bottom left? I did a search through the texturing chapter of the Redbook, but haven't found anything on this. But seeing as for OpenGL the x-axis is right, and the y-axis is up, maybe the same goes for the textures, and the first data block is indeed -logically- the bottom left. Does anyone have some links to documents on this matter?

Share this post


Link to post
Share on other sites
Advertisement
In openGL the first byte of a texture in top left if you use the coord system like this : 0,0,1 (up is z)
if you use (0,1,0) (up is y) then its bottom left. ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!