Jump to content
  • Advertisement

Archived

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

DeschutesCore

Targa Loader - .tga image issues

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

Does anyone know what editor NeHe uses to create his tga files? I''ve written a TGA image loader for my Delphi OpenGL projects and the .tga files included in his demos load fine. If I create a new tga file in PSP7 or Photoshop, use one from Quake3, or use one from any other source, they appear pure white. Any ideas on this one BTW? Jason

Share this post


Link to post
Share on other sites
Advertisement
It could be your photo program but just for something for you to try. I had that same problem a while back. Where no matter what I did it was pure white. I discovered that I had not enabled textures. I don''t know how you would do it with TGA files. Haven''t done that tutorial yet, but with the way NeHe sets it up to do it with BMP''s do the following in InitGL()
glEnable(GL_TEXTURE_2D);

Hope this helps!

Share this post


Link to post
Share on other sites
No, the issue isn''t texturing.

Nehe''s .tga files display just fine. Other ones display white. I''ve used two different professional packages(3DStudio Max 3.1 and Adobe PhotoShop) in addition to Paint Shop Pro. This isn''t an issue of poor specification support by the programs generating the tga files, it''s my loader and something about nehe''s images.

Nehe''s .tga file texture my quad just fine, as do bitmaps. If I load his font.tga file, it display, if I edit it in all the above programs, it still works, but if I create a new one, it display''s pure white. I''ve even ensured that the Alpha channel names match exactly, even though alpha isn''t even being looked at yet.

I appreciate your time and response Running_Wolf.

Jason

Share this post


Link to post
Share on other sites
Did you save the Alpha channel? Without a aplpha channel, then you can get the white effect you are talking since it has no data...

(Of course, not all .tga files have alpha, but you loader should check for that.)

Share this post


Link to post
Share on other sites
Thanks for the reply Elixer.

I am 100% sure the alpha is there and intact. I make my selection, save it as an alpha channel, then close the image and reload it to make sure. I''ve loaded a new image from the channel to back myself up on this one. Nothing.

This one is baffling me.

Jason

Share this post


Link to post
Share on other sites
Null and Void,
That was it exactly. 256k without compression, 213k with. I noticed the file sizes after you asked me that, and they are indeed working now.

Now that I can create images I can see mself, I just need to figure out why the .tga images are tinted blue.

Thank you!

Share this post


Link to post
Share on other sites
Hiho,
you should not only car about RLE but also about the top-down alignment. Some programs like ACDSee 32 save the TGA from the first line down to the last. Some others do it the other way round. So if your texture is sometimes displayed 180° round then you have to switch the Top-Down-Orientation off.

Share this post


Link to post
Share on other sites
As far as your blue tinting,

Did you remember to flip the blue and red channels??

TGA''s file spec I believe states that they store the image in BGR format, as opposed to the RGB format. Perhaps that is why your images appear blue-tinted?

Hope it helps,

-mihkael

Share this post


Link to post
Share on other sites
Thanks for the reply Mihkael.

I''ve already fixed it and updated my site with the new loader a few days ago. My problem wasn''t an issue of not trying to swap, I wasn''t paying attention to the fact that Targa files are stored BGRA, not just BGR like bitmaps. I had to change the 3 to a 4 and it finally functioned correctly.

// Here''s the code that works, it was I * 3 that caused the problems
for I :=0 to Width * Height - 1 do
begin
Front := Pointer(Cardinal(pData) + I * 4);
Back := Pointer(Cardinal(pData) + I * 4 + 2);
Temp := Front^;
Front^ := Back^;
Back^ := Temp;
end;

I appreciate everyone taking the time to help with my little problem. I''m currently working on a set of decompression functions next. I''m sure I''ll be asking more questions.


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!