Results 1 to 3 of 3

Thread: again about transparents textures

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    20

    again about transparents textures

    hello,i have a problem using transparent textures.
    i have a simple code doing this :

    -draw_all_opaque_objects();
    -glEnable(GL_BLEND);
    -draw_all_transparent_objects();
    -glDisable(GL_BLEND);

    ok, all seems to work correctly, but...

    if i have 2 transparent objects intersecting, only a part of transparent object is drawn.

    i have read a lot of post talking about disable the depth test so i changed my code as follow :

    -draw_all_opaque_objects();
    -glEnable(GL_BLEND);
    -glDisable(GL_DEPTH_TEST);
    -draw_all_transparent_objects();
    -glDisable(GL_BLEND);
    -glEnable(GL_DEPTH_TEST);

    now i can draw transparent objects intersecting correctly , but...

    also the opaque objects become transparent !!!

    at the moment i so confusing...

    can u help a poor dude plese ?

    thanks in advance.

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: again about transparents textures

    Don't disable depth test, but disable depth writes with glDepthMask(GL_FALSE) for the transparent objects. That means they are depth tested against the opaque objects, but never against each other, because they don't write their own depth into the buffer.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    20

    Re: again about transparents textures

    ok thanks,
    i have changed glEnable/Disable(DEPTH_TEST) with glDepthMask(GL_FALSE/GL_TRUE) and now all works correctly.

    bye

Similar Threads

  1. model textures being redirected to font textures
    By Tcll5850 in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 09-07-2014, 10:43 PM
  2. FBO Attached Textures Reused as Shader Source Textures
    By Rennie Johnson in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-22-2012, 09:43 PM
  3. Lots of small textures or fewer large textures?
    By jlamanna in forum OpenGL: Advanced Coding
    Replies: 30
    Last Post: 01-12-2004, 03:53 AM
  4. Can i make a point transparents?
    By HanWu in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-18-2002, 08:38 AM
  5. are GL_COLOR_INDEX textures converted to RGBA-Textures?
    By TB-Rex in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 12-18-2000, 06:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean