Jump to content
  • Advertisement
Sign in to follow this  
ReKlipz

PNG 32bit weirdness

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

OK, just recently I added TGA and JPG support to my texture loader, and now have added PNG support, but theres a problem... When I load a PNG with transparency values(an alpha channel), and convert it to red byte, blue byte, green byte, alpha byte in mem for opengl, it works fine but the weird thing is that the libPNG for some odd reason adds a background to it, and merges anything that is semi transparent with the background, therefore I no longer have a 32bit image(well i do, just the rgb changed also, and the alpha went to full opaque), rendering PNG pretty much useless for 32bit textures... I was wondering if there was anyway around this, or if others have noticed it too I downloaded some openglpng library to load png's and it said it supported 32 bit, and it did the exact same thing.. thanks!

Share this post


Link to post
Share on other sites
Advertisement
I use pngs for textures but I've never had any problems with that. You are probably doing something wrong when setting upp libPNG. You could take a look at the source of Corona. It's an open source library for loading images. It supports the PNG format through libPNG.

Share this post


Link to post
Share on other sites
Well, after a total rewrite of my code(couple of improvements also) i realized that i didnt have alpha blending turned on...

someone shoot me please!

but hey, it works!

now to decide whether or not to use palleted textures... and add support for em...

Share this post


Link to post
Share on other sites
Paletted textures support is, to an extant, easy. I just loaded the paletted texture into memory and converted it to a 32 bit texture using the palette to do the conversion. For the alpha channel, I just assumed that it was fully opque except for a color of my choice or one specified in the file format. It's quite easy really.

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!