Jump to content
  • Advertisement
Sign in to follow this  

Transparent png not transparent with sdl_image

This topic is 2785 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 created a png in inkscape with a transparent background, and when I load up the png it has transparency. But when I load it into my game using SDL_image it appears white where it should be transparent. Any ideas? [Edited by - ChrisRX on January 1, 2008 3:02:34 PM]

Share this post

Link to post
Share on other sites
Doesn't that set the alpha of the entire surface though? I've got a png stored with transparent parts, I don't want it all transparent. Thanks anyway

I found it's actually because I'm optimising when I load the image with SDL_DisplayFormat. If I get rid of this it works fine. Is there any way to get the transparency to work with SDL_DisplayFormat?

Share this post

Link to post
Share on other sites
I didn't want to create new topic because i have same problem and SDL_DisplayFormatAlpha didn't solve the problem.
I load PNG image (alpha included) with IMG_load.

Then im creating opengl texture like that


glBindTexture(GL_TEXTURE_2D, TextureID);

glTexImage2D(GL_TEXTURE_2D, 0, mode, surface.w, surface.h, 0, mode, GL_UNSIGNED_BYTE, surface.pixels);
// these affect how this texture is drawn later on...

And as result i get white color instead of transparency.

This is my Opengl alpha settings:

glAlphaFunc(GL_GREATER, 0.5);

What should i do to make it work?


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!