Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

rendering opaque and transparent polygons at the same time

lara_bohinclara_bohinc Member Posts: 1
can somebody please help me?
I've been trying to render opaque polygons which overlap with textured transparent polygons, but either the opaque ones always appear on top of the transparent ones or all of the transparent ones appear on top of the opaque ones.
It's not possible for me to order the polygons correctly, so I presume that I need to use the depth buffer, but whenever I use glEnable(GL_DEPTH_TEST) none of the polygons are rendered (ie blank screen).
I've also tried making the z buffer read-only for transparent polygons, but this doesn't seem to work either.
Please help!

Comments

  • gautamgautam Member Posts: 642
    Hi,

    If polygons are not rendering you might want check the way you are drawing it. Wrong winding setup will make the polygon to not render. By default draw polygons in CCW mode(ie anticlockwise).

    Regarding opaque polygons, first draw all the opaque polygons and then draw all the transparent ones using proper glBlendFunc parameters. Probably glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA) might get you close to what you want but read, understand and experiment with the rest or the options you can pass to glBlendFunc to get the desired result. Dont forget to enable blending though using glEnable(GL_BLEND);.

    Coming to glDisable(GL_DEPTH_TEST) - this will disable depth testing and you wont get the feeling of depth. Nothing to do with opaque and transparent polygons. Also disabling depth buffer writing will get you nowhere as well.






    : can somebody please help me?
    : I've been trying to render opaque polygons which overlap with textured transparent polygons, but either the opaque ones always appear on top of the transparent ones or all of the transparent ones appear on top of the opaque ones.
    : It's not possible for me to order the polygons correctly, so I presume that I need to use the depth buffer, but whenever I use glEnable(GL_DEPTH_TEST) none of the polygons are rendered (ie blank screen).
    : I've also tried making the z buffer read-only for transparent polygons, but this doesn't seem to work either.
    : Please help!
    :

Sign In or Register to comment.