Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: do not see the object in Transparency

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    7

    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.

    void glass()
    {
    glPushMatrix();
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glShadeModel(GL_SMOOTH);
    glTranslatef(d1x, d1y, d1z);
    glRotatef(zAngleB3, 0,0,1);
    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);
    glPopMatrix();
    }

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    490
    Quote Originally Posted by Numan.pk View Post
    i have made the transparent glass in OpenGl but the problem is this that any other object do not see in the glass
    Translucent objects have to be drawn after whatever is behind them.

    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

Posting Permissions

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