TGA loader: reverse height

Posted by aVoX on Game Development See other posts from Game Development or by aVoX
Published on 2012-10-20T23:23:33Z Indexed on 2012/10/21 5:28 UTC
Read the original article Hit count: 221

Filed under:
|

I wrote a TGA image loader in Java which is working perfectly for files created with GIMP as long as they are saved with the option "origin" set to "Top Left" (Note: Actually TGA files are meant to be stored upside down - "Bottom Left" in GIMP). My problem is that I want my image loader to be capable of reading all different kinds of TGAs, so my question is, how do I flip the image upside down?

Note that I store all image data inside a one-dimensional byte array, because OpenGL (glTexImage2D to be specific) requires it that way.

Thanks in advance.

© Game Development or respective owner

Related posts about opengl

Related posts about textures