Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Weird Result with Depth Test
QtWS25 Last Chance

[Solved] Weird Result with Depth Test

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 615 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlastDV
    wrote on last edited by
    #1

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

    (8) Just live your life blind like me (8)

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BlastDV
      wrote on last edited by
      #2

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

      (8) Just live your life blind like me (8)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved