I have 2 cubes, one is closer, second is further. When I look at straight ahead closer and further cubest looks strange (closer cube is too much transparency), when I rotate camera about 270 degrees second cube looks ok (it isn’t so transparent like first one):
Blending does not work with depth testing.
Search the forum / the web / the wiki for details, any solution will be a “performance versus visual quality” tradeoff.
But when I glDisable(GL_DEPTH_TEST) then mine cubes are always closer then other objects - effect is horrible. I have strong computer so I don’t need to performance - what is the solution ?
First, in any case, opaque objects “//here draw other objects” should be drawn FIRST. This is extremely basic stuff, and you have not done it…
So what other information did you learn from your searches ?
Why do people think they can say “I searched” when it’s so easy to show they didn’t? Google for “blending depth buffer”. The very first hit explains your problem in detail and the solution to it.
“The first fix - upon which all the other fixes depend is to make sure you draw all your opaque polygons before you draw any translucent ones. This is easy to do in most applications and solves most of the problems. The only thing that remains is when you try to render one translucent polygon behind another.”
Strange - for me it works when I draw first transparent objects and then not transparent - why ? And in this article they said that I should first draw not transparent and then transparent.
Not my native language either.
Really alex2, just draw first opaque objects, with depth test and writes.
Really.
Then learn to learn from advices given to you.
Might require more GL knowledge than you currently have, but some solutions are full sorting of triangles, depth peeling, weighted average transparency, etc, recently discussed here : http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=294075