Jump to content
  • Advertisement


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


transparent quads

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

im writing a little 2d thing using OGL, using textured quads. How can i make a certain colour in the texture transparent, if im loading the textures from bmp''s? for instance, how can the black outline of a picture of something be made transparent. i looked at nehe''s lesson 9 which does just that, but it doesnt really explain how, it just does it. cheers -scott

Share this post

Link to post
Share on other sites
Hi !
Well, I''ve done this a few times now - but I''ll be doing it off the top of my head as I''m at work.

Edit the texture (assuming it''s a bmp file) with Paint or any image editting program. Change the color you want to be transparent to black (say) as the RGB values=0 for black (making it easy to look for).

Read in the bitmap file - when you see the values of RGB = zero then you set the alpha part for it to what you want.

Then when you render the texture you simply set the blending function in open gl to Alpha or 1-MINUS-Alpha.

Alternatively, if you want the whole texture to be transparent you simply set it using the blend function.

As I say I''m at work but hopefully that''s useful enough.

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.

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!