TGA and Gimp?
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?
Are they an incorrect bit depth? Is the GIMP using any of the extensions (I don''t know if it does personally) to the TGA file format that his code may not support (there''s a lot of them, it''s a pretty extendable format)?
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
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
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
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);
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; i
getc(f);
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement