PDA

View Full Version : Count the no of Z fail



iris_raj
02-11-2007, 11:18 PM
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

jide
02-12-2007, 12:50 AM
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).

Jan
02-12-2007, 12:56 AM
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.

iris_raj
02-12-2007, 02:49 AM
Thanks a lot

iris_raj
02-12-2007, 02:50 AM
Dear Jade and Jin

Thanks a lot.

RAJESH.R

jide
02-12-2007, 07:58 AM
You just misspelled our names but this is okay :)