1. ## 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.

2. ## Re: transparency

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:
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.

3. ## Re: transparency

Originally posted by nexusone:
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

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

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

4. ## Re: transparency

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

5. ## Re: transparency

Cool, thanks guys.

6. ## Re: transparency

how to draw a polygon??

7. ## Re: transparency

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)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•