Jump to content
  • Advertisement
Sign in to follow this  
clint8565

basic TGA question

This topic is 4955 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 using lesson 32 and it runs fine, but if I try to edit one of the images it can't load the TGA anymore, can someone please help me

Share this post


Link to post
Share on other sites
Advertisement
Make sure you are saving them in the correct format. I'm not sure if lesson 32's tga loader supports compressed TGAs. TGAs have lots of options with how they are saved, like compressed, flipped, color depth, alpha channel.. etc..

Share this post


Link to post
Share on other sites
ummm... when I go to save my TGA I don't get any options, it just saves it

I get all kinds of options for PNG, does someone know how to load them in Dev C++?

Share this post


Link to post
Share on other sites
there is a bug in the nehe TGA load code witch makes tga files from PSP8+ not be able to load, but PSP7 saved tga files still work.

It has to do with the idHeader, psp7 doesn't save it but psp8 does(i guess it's the same with other programs to).
the nehe TGA load code asumes that it doesn't exist.

to fix it add
char tgaID[256]; // TGA header

to the beginning of the file right after
TGAHeader tgaheader; // Used To Store Our File Header

and in both LoadCompressedTGA and LoadUncompressedTGA add


if(tgaheader[0])
{
if(fread(&tgaID, tgaheader[0], 1, fTGA) == 0) // Read TGA ID
{
if(fTGA != NULL) // if file is still open
{
fclose(fTGA); // Close it
}
return false; // Return failular
}

}





right after


if((texture->width <= 0) || (texture->height <= 0) || ((texture->bpp != 24) && (texture->bpp !=32))) // Make sure all information is valid
{
if(fTGA != NULL) // Check if file is still open
{
fclose(fTGA); // If so, close it
}
return false; // Return failed
}





This should fix it, perhaps with a little fiddeling.

Share this post


Link to post
Share on other sites
thanks lc_overlord, but I don't know how to fix the errors

TGALoader.cpp In function `bool LoadUncompressedTGA(Texture*, char*, FILE*)':
85 TGALoader.cpp no match for 'operator[]' in 'tgaheader[0]'
89 TGALoader.cpp `lg' undeclared (first use this function)
89 TGALoader.cpp `CF_ERROR' undeclared (first use this function)

and the same for LoadCompressedTGA



thanks vampyre_dark, could you tell me how to use the devpak? I can't find a help or any examples

[Edited by - clint8565 on November 25, 2004 2:16:17 PM]

Share this post


Link to post
Share on other sites
Hmm i might have revritten the code just a little bit to mutch.

You can delete line 89 it's just a part of my error logger, so remove it.

the bug on line 85 is a bit tricky, but if you replace tgaheader[0] with a char and take the first byte from the header and put it in that char.

my tga header is just a array of 12 chars, witch makes it more easy to read the compression type.
Perhaps i should just take the lesson 32 code, modify it and put it on the web.

Share this post


Link to post
Share on other sites
Quote:
Original post by clint8565

thanks vampyre_dark, could you tell me how to use the devpak? I can't find a help or any examples


I've never used it before. You're going to need to find the header, and the libray file. Read the header (or a readme.txt).
I'm guessing it's

libping.a
libping.h

Share this post


Link to post
Share on other sites
lc_overlord, if you want to mod one of the tut's for on the web you could use 33 it's the same, at least for the TGA part, 33's a lot simpler that's all

umm... I got rid of line 89, but I'm not exactly sure what to do with tgaheader[0]

do you mean like make a variable
char something = tgaheader[0]; ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!