Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: PolygonOffset state and the depth test

  1. #1
    Member Regular Contributor DmitryM's Avatar
    Join Date
    Mar 2009
    Location
    Toronto
    Posts
    436

    PolygonOffset state and the depth test

    Is PolygonOffset applied when the depth test is off?

    It is not obvious to figure out the answer by reading the spec (ES 2.0 section 3.5.2). On one hand, the spec doesn't mention the need for a depth test, and the polygon offset is described separately from the fragment processing stages. On the other hand, it says:
    ... units scales an implementation-dependent constant that relates to the usable resolution of the depth buffer.
    And later on:
    It is the smallest difference in window coordinate z values that is guaranteed to remain distinct throughout polygon rasterization and in the depth buffer.
    Hence, the question rises: what if we don't have a depth buffer attached? Or, in particular, we just disabled it by setting the depth test to OFF? It's not only the issue of how the offset is computed in this case, but also - it's difficult to imagine a use-case for it.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: PolygonOffset state and the depth test

    Depth test being off does not mean the depth *buffer* does not exists, so I would guess it should work.

    If no depth buffer is attached, however... no clue.

  3. #3
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    250

    Re: PolygonOffset state and the depth test

    if you need polygon offset you are probably .. doing it wrong. It works but you'll never get consistent results across different hardware. That's my experience anyway.

  4. #4
    Member Regular Contributor DmitryM's Avatar
    Join Date
    Mar 2009
    Location
    Toronto
    Posts
    436

    Re: PolygonOffset state and the depth test

    Thanks for your answers.
    Quote Originally Posted by ZbuffeR
    If no depth buffer is attached, however... no clue.
    Does it look like a bug in a spec for you? The question wouldn't exist if they put a line like "The unit offset is zero if no depth buffer is attached."

    Quote Originally Posted by durkey
    if you need polygon offset you are probably .. doing it wrong.
    It's not that I need polygon offset for something, it's that I need to provide the functionality to use it. Hence, my internal dillema was: whether I need the user to pass polygon offset parameters in a context of the depth test settings, or regardless of that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •