How to make transparency in images

Started by
4 comments, last by riruilo 15 years, 2 months ago
hai friend, i have a doubt, to make transparency in images..please give me idea to make two images transparent with one another. sundar..
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]
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.
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
Have you tried this NeHe lesson? And if that doesn't answer your question, could you please explain your question in greater detail?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
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.
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
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.
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.

This topic is closed to new replies.

Advertisement