View Full Version : How to use a texture's transparancy?
I am drawing some textures on screen, and I want to use their alpha value. They were loaded as a texture with an alpha (I've visually tested this to be true with glAlphaFunc).
How can I do it? I've tried glBlendFunc but it seems to be ignoring the texture alpha.
Rob The Bloke
12-26-2000, 10:24 AM
You should just be able to use :
glBlendFunc( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND_FUNC );
If you want to make use of the textures alpha channel once it has been drawn to the frame buffer, you can use :
glBlendFunc( GL_DST_ALPHA , GL_ONE_MINUS_DST_ALPHA );
Only use this however if your 3d hardware supports an alpha channel ( very few do... )
12-27-2000, 05:11 AM
You might get better results if you
12-27-2000, 08:40 PM
It may also be important to get the right texturing mode(GL_TEXTURE_ENV_MODE, I believe)...whether you're using GL_REPLACE, GL_MODULATE, GL_DECAL, etc. These affect how it calculates the alpha value for the current fragment(based on the texture's alpha and the fragment's alpha as per the current state).
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.