Advertisement

targa file loader

Started by September 25, 2000 08:42 PM
6 comments, last by arsenius 24 years, 3 months ago
Does anyone out there know a good place to find out the header info for a targa file? All I could find on the ''net was "A targa file is a truespace picture format, blah blah blah" Nothing saying the header Or else loader code would be okay too, but i''d prefer the header infos. Oh, I tried a search on gamedev too, but it just kept timing out, until I let it search the maximum # of days, which is 30, which IMHO is way too short. somethin should be done about that -arsenius 'after three days without programming, life becomes meaningless' -The Tao of Programming
For simple uncompressed TGA''s this could be enough...?...:

    #pragma pack( push, 1 )typedef struct{	unsigned char	SizeOfDescription;	//	0 = not present	unsigned char	ColorMap;			//	0 = not present	unsigned char	ImageType;			//	1=8-bit palette style, 2=Direct <A href=''http://RGB image, 3=grayscale, 9=RLE version of Type 1, 10=RLE version of Type 2, 11=RLE version of Type 3	unsigned short	IndexInColorMap;	//	0	unsigned short	ColorMapSize;	unsigned char	BitsPerColor;	unsigned short	XOffset;	unsigned short	YOffset;	unsigned short	Width;	unsigned short	Height;	unsigned char	BitsPerPixel;		//24	(32 for alpha)	unsigned char	Attributes;}TGAHEADER, *PTGAHEADER;#pragma pack( pop, 1 )    
'' Target=_Blank>Link

Advertisement
thanks
does anyone know a really easy bitmap format? something like:

    int bitsperpixel;int width;int height;    


I haven''t seen any like this, I think it would be really nice though, cause I could write a loader in about 2 seconds

fin >> bitsperpixel >> width >> height;
buffer = new[width*height*(bitsperpixel/8)];
for (int x = 0; x < width * height; x++)
{
fin >> data;
buffer[x] = data;
}

isn''t that better than a huge function? Of course, you''d have to expand it just slightly, but not very much

-arsenius
'after three days without programming, life becomes meaningless' -The Tao of Programming
Remember: You can always create your own data formats. :p

WhoopA, the Official Kicker of Butts

--- Home Page, visit at your own risk!
The future is not set. There is no fate, but what we make of ourselves.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
Try here:

Graphics File Formats Page

- Dire Wolf
direwolf@digitalfiends.com

Edited by - Dire.Wolf on September 26, 2000 10:02:50 AM
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
quote: Original post by WhoopA

Remember: You can always create your own data formats. :p

WhoopA, the Official Kicker of Butts

--- Home Page, visit at your own risk!
The future is not set. There is no fate, but what we make of ourselves.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.


that''s true, but that would be more work than writing the loader fot an existing format, plus, I would have to use a converter program to convert from an existing format to my own right? or is there a way to specify exactly how you want your image saved in some graphics programs?


-arsenius
'after three days without programming, life becomes meaningless' -The Tao of Programming
Advertisement
wotsit (http://www.wotsit.org/)
is also a good place for file format freaks...
nehe has a tutorial about that ( Link ).
It is tutorial no 25 I think..

Snale
+--Java Game

This topic is closed to new replies.

Advertisement