[Solved] Weird Result with Depth Test
-
wrote on 10 Mar 2014, 03:56 last edited by
I'm having a problem when I enable GL_DEPTH_TEST when rendering my objects, here's what happens:
!http://imageshack.com/a/img19/5885/d8he.png(http://imageshack.com/a/img19/5885/d8he.png)!
GL_CULL_FACE is disable on that one.
Of course, if I disable the depth test, it looks fine, but then the objects overlays in a wrong way, as expected.
It only happens with perspective view! Does anyone have and idea of what's happening?
I'm using Qt 4.8 for this, does Qt have a known issue with this?
Thanks in advance! I'll also post any information you need! :)
-
wrote on 16 Jul 2014, 14:53 last edited by
I found the answer long time ago. I hope this helps other people with the same problem.
As jozxyqk says:
"The near value of the [EDIT perspective] projection matrix is zero. This results in all depth values equal to one after the perspective divide (.xyz/.w). @Raxvan clearly had the right idea. Try this...ProjectionMatrix.perspective(45, float(width) / float(height), 0.01, 20.0); ..."
The whole answer can be found "here.":http://stackoverflow.com/questions/22291120/weird-result-with-depth-test
Marking this as solved ...