transparency and depth

Hello all!

I’m programming a very simple 2D app which has several opaque polygons drawn at z = 0, a 50% transparent circle at z = 1 and then some more opaque polygons at z = 0. The circle is supposed to float above all other objects and blend equally regardless of their ‘age’.

The problem is that over the ‘newer’ polygons the transparent circle becomes opaque and the order in which the objects are drawn cannot be changed due to restrictions in my program design.

Now, someone suggested that I should disable the depth buffer by using glDisable(GL_DEPTH_TEST) but that just makes the transparent circle dissapear behind the ‘newer’ polygons.

How can I draw a transparent floating circle above items that were drawn after it? Is it possible? What should I do?

Thank you very much for your time!


You need to change your program design such that you draw in 2 stages

1)Draw all you opaque and other geometry

  1. Draw you Transparent geometry ( if you only have one geom here you can turn depth testing off as well)

Generally you have to draw your transparent geometry last, most books will tell you this