Click here to Skip to main content
14,362,507 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi every body
I have an texture in a quad. but it's picture have transparent. OpenGL show that like this :[^]

what can I do ? ( i work with sdl )
Abhishek Pant 19-Dec-12 10:54am
use photoshop!

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

In OpenGL texture mapping, Transparency can be implemented through alpha blending. You can use GL_RGBA8 texture format to create Alpha enabled texture. Provide proper alpha values to get transparency. To get get opaque image, provide 255 as alpha value and to get fully transparent pixel provide 0 as alpha value. For semi-transparent pixels provide 128 as the alpha value.

On texture mapping enable blending to get transparent effect to the drawn image.

// This function render the image with alpha blending to display only the alpha pixels.
    glEnable( GL_BLEND );
// Texture mapping code... 
// On drawing texture image, color of texel will be multiplied with the existing image.
// and it will provide transparent effect.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100