• Advertisement
Sign in to follow this  

How to make transparency in images

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

hai friend, i have a doubt, to make transparency in images..please give me idea to make two images transparent with one another. sundar..

Share this post


Link to post
Share on other sites
Advertisement
Use blending, glEnable(GL_BLEND). If you want your image to have the same transparency all over you only need to draw the image with glColorf4(1,1,1,0.5). If you want varying transparency your image needs an alpha channel. PNG and TGA image formats supports alpha channel. You also need to set the blend function, glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) is a good blend mode to start with.

Reference:
glBlendFunc C Specification

[Edited by - O-san on January 23, 2009 6:02:22 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by O-san
Use blending, glEnable(GL_BLEND). If you want your image to have the same transparency all over you only need to draw the image with glColorf4(1,1,1,0.5). If you want varying transparency your image needs an alpha channel. PNG and TGA image formats supports alpha channel. You also need to set the blend function, glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) is a good blend mode to start with.

Reference:
glBlendFunc C Specification


@O-san: What about if I want these two different transparencies together? Using fixed pipeline.

Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by MikeTacular
Have you tried this NeHe lesson? And if that doesn't answer your question, could you please explain your question in greater detail?


Of course, actually I ask something similar yesterday:

http://www.gamedev.net/community/forums/topic.asp?topic_id=521985

But I still don't know how to dot it.

Any suggestion?

Thanks a lot.

Share this post


Link to post
Share on other sites
Quote:
Original post by MikeTacular
Have you tried this NeHe lesson? And if that doesn't answer your question, could you please explain your question in greater detail?


Thanks, I got it reading NeHe. Thanks a lot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement