PDA

View Full Version : lighting and transparency



mithun_daa
10-29-2003, 11:45 AM
im sorry, im gonna rephrase my doubt again.
i have a scene with a few overlapping polygons, and i want them to be totally opaque. so basically it should hide the hidden surfaces. but thatz not happening. i can c the two polygons within each other which is what i dont want. i just want one polygon(closest one) to overlap the other ( one at the back). i think im havin problems with hidden surface removal.

[This message has been edited by mithun_daa (edited 10-30-2003).]

fuxifuxi
10-29-2003, 12:17 PM
Transparency is complicated. You should sort your objects and render them from back to front in order to achieve correct transparency. However, in your case, you haven't enabled blending. Blending is the one that affects transparency, not alpha.

you should enable blending, set a transparency blending, and then render your objects.

Here is how it's done:

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


Hope it works...

Relic
10-30-2003, 04:55 AM
"i have set the transperency of the polygons using the glcolor4f and setting alpha to 1"

It's the other way round, alpha describes opacity in OpenGL.
alpha == 1.0 means fully opaque, same as if you would send glColor3f.