Jump to content
  • Advertisement

Archived

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

tsuraan

TGA and Gimp?

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

I''m trying to make targa images to be loaded into my program using the origional .tga loading code from one of nehe''s tuts (this isn''t the code that supports compression). When I use the Gimp and save images, they are somehow corrupted. Gimp can open them, but nehe''s code won''t. I''m not compressing the images, so that''s not the problem, but I have no idea what the problem is. Has anyone had any experience with this?

Share this post


Link to post
Share on other sites
Advertisement
Do you have an Alpha channel (32 bits/pixel)? If you are, that''s where the problem is, because, as I remember, he didn''t properly if/then/else it such that it''d handle RGB and RGBA.

You''ll need to find where he codes in GL_RGB and replace it with GL_RGBA. In each function you do that, there''s another parameter in the function call that is 3; change that 3 to 4 and you should be set. *crosses fingers*

~ Dragonus

Share this post


Link to post
Share on other sites
check the TGA file spec for info on whats happening

struct TGAImageHeader
{
GLubyte id; // the number of bytes in image ID (comes after imageDescription) + before the actual image data
GLubyte colormap;
GLubyte imageType;
GLubyte colormapSpec[5];

GLubyte xOrigin[2];
GLubyte yOrigin[2];
GLubyte width[2];
GLubyte height[2];
GLubyte bitDepth;
GLubyte imageDescription;
};

fread(header,1,sizeof(TGAImageHeader),f);

// skip past the id field (if there is one)
for ( i=0; iid; i++ )
getc(f);

Share this post


Link to post
Share on other sites
Maybe this is a stupid question, but where do you find specs like that? Is there some central repository where all the formats for images and animations and stuff are kept?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!