do not see the object in Transparency
Hi every body.
i have made the transparent glass in OpenGl but the problem is this that any other object do not see in the glass, so any one can help me what's the problem.
glTranslatef(d1x, d1y, d1z);
glRotatef( -90.0, 1.0, 0.0, 0.0 );
glDisable( GL_CULL_FACE );
glColor4f(0.9f, 0.9f, 0.9f, 0.2);
drawGluSlantCylinderWithCaps( 2.5, 0.8, 0.8, 20, 1);
Translucent objects have to be drawn after whatever is behind them.
Originally Posted by Numan.pk
In general, opaque objects should be drawn first, then translucent objects drawn afterwards from back to front with depth writes and tests disabled. Non-convex objects may need to be split into convex sections (possibly into individual polygons).
If objects are far apart relative to their size, sorting by nearest/farthest/average Z may suffice. Otherwise, you need to perform a topological sort, which can be quite complex (e.g. in the case of cyclical overlap).
An alternative is "depth peeling", which uses shaders, framebuffer objects and multiple passes, but that's not exactly simple either.
Tags for this Thread