Tuesday, 22 January 2013

OpenGL ES and occlusion queries

This is a follow-up to my earlier post "WebGL doesn't have query objects".

Since I wrote that post, the situation has changed a bit. It's still true to say that WebGL doesn't have query objects, but the underlying reason - that OpenGL ES doesn't - is no longer true.

For OpenGL ES 2.0, there's an extension which provides basic query functionality: EXT_occlusion_query_boolean (which seems to have been based on ARB_occlusion_query2 from regular OpenGL). For OpenGL ES 3.0, the functionality from that extension appears to have been adopted into the standard. The extension provides two query types, both of which set a boolean value to indicate whether any pixels passed the depth and stencil tests.

While this is progress, unfortunately it's still not sufficient to implement the pixel accurate collision detection method I described in an earlier post. For that purpose it's not enough to know whether any pixels passed the tests; you want to know whether all the pixels passed the tests (or, equivalently, whether any failed).

The extension which introduced occlusion queries to regular OpenGL, ARB_occlusion_query, has a discussion of why they chose to expose integer counts rather than booleans. It argues that a simple boolean is not enough for many useful and interesting applications; and for obvious reasons, I agree! So it's a shame that OpenGL ES has chosen to go with the more limited form - especially since it's likely that WebGL will follow that choice.

Thursday, 17 January 2013

A handy little script for QtCreator users

If you use QtCreator for what it calls "generic projects" I've written a little script which might be useful for you:

https://github.com/vilya/newfiles

This script will rescan your project directories to see whether any files & include directories have been added or removed and update the QtCreator project files accordingly - something QtCreator isn't yet able to do for itself. It has a few extra features too, such as whitelisting or blacklisting paths using shell-style wildcards.

See the README file at the link above for more details.