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 6 of 6

Thread: Count the no of Z fail

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Count the no of Z fail

    Dear All,

    Is it possible to count the no of times Z comparison failed.This is very useful for
    solving one of my algorithm

    RAJESH.R

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,749

    Re: Count the no of Z fail

    For each object ? For each fragment ? For all the buffer ?

    Depending on what you really need to do, occlusion queries might help you.

    Otherwise there is the stencil buffer, but it might be really difficult to do so with it if not impossible (due to high counts).

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: Count the no of Z fail

    Yes, that is possible.

    Use Occlusion Queries, to count pixels of what you render.

    First render your object with depth-function GL_ALWAYS (and maybe color and depth-writes disabled, so that it has no effects, after all).
    Count how many pixels were rendered.

    Second, render your object, as you would render it usually and again count the number of pixels rendered.

    Subtract the second number from the first and you know how many pixels were rejected during the z-test.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Re: Count the no of Z fail

    Thanks a lot

  5. #5
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Re: Count the no of Z fail

    Dear Jade and Jin

    Thanks a lot.

    RAJESH.R

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,749

    Re: Count the no of Z fail

    You just misspelled our names but this is okay

Posting Permissions

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