[Solved] Weird Result with Depth Test



  • 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! :)



  • 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 ...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.