View Full Version : transparency

04-05-2001, 03:52 AM
I would like to make transparent the polygon that I am drawing (depending on my variable GLfloat transparency).
But I do not know how (glEnable (GL_BLEND),glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)??) nor where (in my GLInit and before drawing it??).
I am not using textures.

Rob The Bloke
04-05-2001, 04:42 AM
do the following:

glEnable (GL_BLEND);


glDisable( GL_BLEND );

bear in mind that for this to work properly, your polygons should be drawn in order with the furthest away on drawn first moving closer to the view position.
You object will also have to have an alpha value specified, do this with
glColor4f( r,g,b,a );

whenever the alpha value is zero, the object will be invisable, 1 and the object will be opaque

[This message has been edited by Rob The Bloke (edited 04-05-2001).]

[This message has been edited by Rob The Bloke (edited 04-05-2001).]

04-05-2001, 05:38 AM
That was also my question, and I got it work. I'm using materials and just wondering what colors (Ambient, Diffuse, Emission, Specular) should have alpha component, and how do they affect?