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.
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.
Comments
Post a Comment