TGA Import Error

Started by
3 comments, last by monachus 11 years, 10 months ago
[color=#888888][font=arial, sans-serif]

[background=rgb(245, 245, 245)]


[color=#333333]

I have a problem with importing and loading TGA images.
I used the tutorial:http://nehe.gamedev.net/tutorial/loading_compressed_and_uncompressed_tga's/22001 /

I Export files with GIMP

I have the error:

TGA file be type 2 or type 10

Thanks in advance.




[color=#444444][size=2][/background][/font]

Advertisement
Ensure that you have a 24 bit RGB or 32 bit RGBA image, no greyscale or color palette.
I had this problem initially when I started to use TGA images for textures.

http://www.organicbit.com/closecombat/formats/tga.html
http://tgalib.sourceforge.net/api/r28.html

I believe that tutorial may be old, check the listed resources and try updating your header format to best resemble the examples from the resources.

You can double check by simply printing out the variables to double check what is saved in each variable matches what you have in GIMP. By default, I recommend using 32bit RGBA export settings.
[size=2]hopper.dustin@gmail.com
Type 2 is raw data and type 10 is run-length encoded data.
Now you need to handle indexed data, black-and-white data, and true-color data.
Read the TGA specifications to find out how.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

What do you need it for? This is a good opportunity to read the TGA spec and implement a very simple reader that suits your needs.
In my case, some time ago I needed a TGA loader for a simple arcade game. I implemented a simple, small reader that only read 24bit uncompressed images that I had exported from GIMP. Good enough for my needs and I was a better programmer when I finished.

Read the spec, you will learn a lot and you will have a lot more fun because you will have understanding.

This topic is closed to new replies.

Advertisement