Click here to Skip to main content
13,085,613 members (105,649 online)
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 )
Posted 19-Dec-12 1:42am
Abhishek Pant 19-Dec-12 10:54am
use photoshop!

1 solution

Rate this: bad
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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