View Full Version : Count the no of Z fail
02-11-2007, 11:18 PM
Is it possible to count the no of times Z comparison failed.This is very useful for
solving one of my algorithm
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).
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.
02-12-2007, 02:49 AM
Thanks a lot
02-12-2007, 02:50 AM
Dear Jade and Jin
Thanks a lot.
You just misspelled our names but this is okay :)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.