Jump to content
  • Advertisement
Sign in to follow this  
starfleetrp

Transparency

This topic is 4460 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 am a bit confused of how I would do transparency of the black background of an image. So that any part of the RGB image with no alpha chanel that is black will be completely transparent. I am using OpenGL!

Share this post


Link to post
Share on other sites
Advertisement
You're thinking in terms of a color key, which is more common for 2D libraries like SDL and DirectDraw. Moving to 3D you want to start to think of using the alpha channel of your image.

You could accomplish the transparency with a mask, but the better option is using either alpha blending or alpha testing.

If your image has sharp edges (not antialiased) then you can do alpha testing, otherwise use blending.

You can programmatically set the alpha value to 0 for every black pixel at runtime or you can preprocess the images with your favorite image editor to make the black transparent and save as a file format that holds alpha information (TGA, PNG, DDS, TIF).

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!