Jump to content
  • Advertisement
Sign in to follow this  
Cypher777

Creating Targa Files in PSP 8.0?

This topic is 5093 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 create some Targa files for a project I'm currently working on, but I can't seem to get them to work using NeHe's Targa image loader from lesson 24("Initialization Failed." error). Looking around a little bit on the Internet has yielded no help either. Can anybody tell or point me in the direction of the proper way to create 32-bit Targa files using Paint Shop Pro 8.0? Or a compatible loader? The code that creates the "Initialization Failed." error is ...
if(	file==NULL ||fread(TGAcompare,1,sizeof(TGAcompare),file)!=sizeof(TGAcompare) ||	memcmp(TGAheader,TGAcompare,sizeof(TGAheader))!=0 ||	fread(header,1,sizeof(header),file)!=sizeof(header))
{
     if (file == NULL)
          return false;
     else    // <======== this else statement executes, resulting in a  value of false being returned
     {
	fclose(file);				
	return false;					
     }
}

Edited several times to make Targa code more readable



Share this post


Link to post
Share on other sites
Advertisement
Go here and download the TGA specification (the one from Truevision).

I assume the problem is the memcmp function, which returns non-zero. This is because you're comparing the actual header with a pre-defined header, a pre-defined header which does not work with TGAs exported from PSP8. PSP8 writes some extra information, which is not handled by your loader.

The files written by PSP8 are correct according to the specification, so you just have to make a more generic loader to handle the extra information.

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.

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!