Archived

This topic is now archived and is closed to further replies.

TGA Image Format Flipped?

This topic is 5118 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

Hello All, Ive just wrote a TGA loader following the spec from the Targa PDF documene. The problem is, everytime i load an image, its flipped vertically but the the header bits that specify if the image is flipped is set to 0...i have tried multiple TGA files and made ones exported from Adobe Photoshop and Paintshop Pro and they all come out flipped. I have compared my loading code to no end of TGA loading examples and im not doing anything different... I am applying the loaded image on a 2d projected quad (OpenGL). I have other image loaders such as JPEG which load the images and when applied to the quad, its correct so it cant be my winding order. Ive torn my hair out as to why TGA files are flipped!?!? It doesnt say in the spec that this is standard of TGA files, can anyone englighten me please. Thanks MeshMan

Share this post


Link to post
Share on other sites
quote:
Original post by MeshMan
Hello All,

Ive just wrote a TGA loader following the spec from the Targa PDF documene. The problem is, everytime i load an image, its flipped vertically but the the header bits that specify if the image is flipped is set to 0...i have tried multiple TGA files and made ones exported from Adobe Photoshop and Paintshop Pro and they all come out flipped. I have compared my loading code to no end of TGA loading examples and im not doing anything different...

I am applying the loaded image on a 2d projected quad (OpenGL). I have other image loaders such as JPEG which load the images and when applied to the quad, its correct so it cant be my winding order.

Ive torn my hair out as to why TGA files are flipped!?!? It doesnt say in the spec that this is standard of TGA files, can anyone englighten me please.

Thanks
MeshMan


I have come up with the same conclusion... no solutions that I know of besides either storing it upside down in the file, or loading it upside down.

Share this post


Link to post
Share on other sites
If bits 4 and 5 in the Image Descriptor field (unpadded it would be offset 11h in the file) are zero then the image is "upside down".

I usually just blit them in reverse (takes the same ammount of time as blitting them forward), instead of loading them in reverse.

Share this post


Link to post
Share on other sites
Brilliant!

Stupid me, im just going through the docs again and like you''ve said i realise its bottom-up reading when bits are not set...

Thanks guys!

- MeshMan

Share this post


Link to post
Share on other sites