# transparency

I’ve only messed with OpenGL a little. I use it with C++ and Glut. Forgive me if this seems too novice. How do I make a polygon transparent? Yes, it has to do with the alpha values, but how do I use it?

Lets say I have a simple triangle in front of a quad. I use float values for the color. What do I do to see the quad through the triangle? What do I need to enable? I’m trying to keep this case very simple so as to keep the answer simple.

Use this color function before the object.

glColor4f(r, g, b, a)

alpha channel set’s transparency

t = 0.0 to 1.0.
1.0 = non-transparent
0.5 = 50% transparent
0.0 = transparent

Originally posted by drummerboy_2002:
[b]I’ve only messed with OpenGL a little. I use it with C++ and Glut. Forgive me if this seems too novice. How do I make a polygon transparent? Yes, it has to do with the alpha values, but how do I use it?

Lets say I have a simple triangle in front of a quad. I use float values for the color. What do I do to see the quad through the triangle? What do I need to enable? I’m trying to keep this case very simple so as to keep the answer simple.[/b]

Originally posted by nexusone:
[b]Use this color function before the object.

glColor4f(r, g, b, a)

alpha channel set’s transparency

t = 0.0 to 1.0.
1.0 = non-transparent
0.5 = 50% transparent
0.0 = transparent

[/b]

Although you might want to enable alpha blending for that to work…

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

And you have to draw your promitives in back to front order.

Cool, thanks guys.

how to draw a polygon??

Originally posted by sim3:
how to draw a polygon??

Choosing GL_POLYGON as primitive.
And then the standard: glBegin/glEnd, DL, VA, CVA, VAR, VAO (just what you want and what is supported by your hardware)