View Full Version : how can i make surfaces transparent ?
02-23-2000, 12:17 AM
If i want to make surfaces transparent, what
do i have to do?
use alpha blending.
enable blending and set the blend function:
then draw anything you need, but remember to specify the alpha (opacity) value, maybe with a call to glColor4f()
Not to long ago i had this problem, Thanks to MikeC and some other ppls I got it sorted out.
To use transperancy I first load a windows bitmap as my texture (RGB) transperancy does however require RGBA. So you need to create the A or Alpha channel yourself.
So in my bitmap I put a color where I want transperancy I use 0,255,0 (pure green) After my bitmap is loaded i check each bit of bitmap data for RED=0, GREEN=255, and BLUE=0, If this is the case then i set in my ALPHA channel bit to 0 (fully transperant) all the way to 255 (no transperancy)
In the above you need to allocate enough memory for the BMP and the extra ALPHA channel or else you will do some nasty things to your memory.
Once you have loaded succesfully you need to enable Blending - glEnable (GL_BLEND);
and set your blending mode -
Your polys should be drawn from furthest to closet when using this or you will find some objects get blended incorrectly.
Hope to help.
[This message has been edited by dans (edited 02-23-2000).]
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.