I have several (potentially thousands) of scenes I would like to render in order to perform queries on what is drawn. The problem I am running into is that calls to glGetQueryObjectiv()
are expensive, so I'd like to figure out a way to render several scenes in advance while I wait for the results of the queries to become available.
I have read a bit about Framebuffer Objects and Pixel Buffer Objects, but mostly in the context of saving to a file using glReadPixels()
and I haven't been able to track down an example of using either of these objects in asynchronous queries. Is there any reason why the setup for performing glGetQueryObjectiv()
would be different from glReadPixels()
as in this example (e.g., should I use an FBO or a PBO)?
Note: This is NOT for a graphics application. All I'm interested in is the result of the GL_SAMPLES_PASSED query (i.e. how many pixels were drawn?).
The specific application is estimating how much sunlight is striking a surface when other surfaces are casting shadows. If you are interested, you can read about it here.