Jump to content
  • Advertisement
Sign in to follow this  
benwestgarth

Some targas work, some don't - texture mapping

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

Quote:
benwestgarth
odiusangel: that's very odd. I've compared your code that reads the header with my code, and it's identical (unless your seek or read isn't working correctly). If you step-debug through the code with an erroneous file, does it read the width and bits there incorrectly? If so, you're welcome to send the .tga file my way and I'll give it a swing.


Yeah, that is exactly what happens. I managed to create a non-working file. It should be 256x265 and 24 bit. Nothing shows up when I load it. You can download it here: members.lycos.co.uk/extralongpants/block.zip. Thank you for taking the time to help me out, I really appreciate it!

Share this post


Link to post
Share on other sites
Advertisement
That file works fine for me clicky. And since the loading code seems correct (this is the first snippet of my loading code):


// Read in the length in bytes from the header to the pixel data
file.Read(&length, sizeof(byte));

// Jump over one byte
file.Seek(1, SEEK_CUR);

// Read in the imageType (RLE, RGB, etc...)
file.Read(&imageType, sizeof(byte));

// Skip past general information we don't care about
file.Seek(9, SEEK_CUR);

// Read the width, height and bits per pixel (16, 24 or 32)
file.Read(&width, sizeof(WORD));
file.Read(&height, sizeof(WORD));
file.Read(&bits, sizeof(byte));




I can only conclude that your file/stream reading code might not be working correctly. Possibly the seeks aren't working correctly?

Share this post


Link to post
Share on other sites
Thanks to everyone for your help. The problem was to do with the dimensions of my images as soon as I scaled them to dimensions of 2^n it worked.

Until next time.
Ben

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!