my tga loader isn’t loading tga’s! grrr… if you could take a look at my loader and spot any errors that i might have missed that would help me out alot. Thanx!
i dont think im putting in the right value for m_type. i want to skip the first 2 bytes of data of the header and get the type. i try to do this using the file.seekg(2,ios::beg); but i think that im using it wrong and putting wrong data into m_type. how can i skip data in a file/fix this problem?
You want to check the third byte in the file for either 2 or 3. 2 being black and white, 3 being true color, both being uncompressed. Check the spec for the other identifiers. www.wotsit.org
EDIT:
You should be doing a logical AND (&&) rather than a logical OR.
Old GLman
[This message has been edited by Old GLman (edited 12-12-2002).]
You are right about your diagnose of the m_type values not being the appropriate ones…
The 1, 2, 3, 4 are simply the number of channels (bytes) you are reading per pixel. But there is no such thing in the header of a TGA file. Instead, you read the number of bits per pixel (bpp). So, you would have 8, 16, 24, 32.
Well, where do these 1, 2, 3, 4 come from?
You divide the bpp, which is the third unsigned char in the header as you are reading, and divide it by 8. 8 is the number of bits in a byte.
You will also have more problems if the tga is compressed or palletted or so and so and more sos.