09-14-2010, 04:04 PM
I'm trying to implement occlusion culling, using glGen/Begin/EndQuery, and I've hit a bit of a wall in my implementation. My engine renders the scene in two passes; the first only renders solid/alpha test objects and runs closest to furthest to best take advantage of early z-buffer fail. Then, in a second pass, it goes furthest to nearest rendering transparent objects, ensuring that they all render in the correct order. The problem is that it seems according to the docs that any call to glBeginQuery resets the fragment counter. I have three solutions in mind for this; find a way to avoid resetting it, use two counters and add the results myself, or remove the two pass solution and damage performance on older systems. Any ideas?