It is my understanding that OpenGL 2.0 now has an ARB extension built in that handles Occlusion culling. I looked it up in the 2.0 spec doc and seen some reference to it, but unfortunately there was nothing that really explained, at least to me, how to implement it. I was wondering if someone can give a “brief” example of how it is used. I understand that you must use a BeginQuery() and an EndQuery() around it. But I do not quite understand what the enum <target> and uint <id> variables are supposed to represent? The document says that <target> is the SAMPLES_PASSED. But what does that mean? I am guessing that the <id> can just be a #defined value that is used to represent a query, but not completely sure on that part either. Then the documentation talks about a GenQueries() function.The functions takes a sizei <n> variable. Not sure what that means, though I am guessing it is just an int variable that represents the number of polygons possibly? And it also takes a uint <*ids> variable. Again, not sure what this is refering to but think it is some type of #defined variable like in the BeginQuery() function. After the documentation talks about the GenQueries() function it then talks about a DeleteQueries() function. When is this needed? How do you interact with these 4 functions?
Here is what I am hoping to accomplish. I have a scene that consists of several objects. What I want to do is create a simple bounding rectangle, as seen from the perspective of the camera, around each object. Then determine the Z depth order of the created bounding rectangles. Starting from the closest, I want to use the closest bounding rectangle as an occluder and do a test to see how much of the object, now the bounding rectangles, is seen and discard any that show a minimal amount of pixels. Then I continue through the Z depth order for the objects continuing the test against the bounding rectangles of the objects deeper within the scene. In a sense, it is a kind of scene graph. So it is these bounding rectangles that I want to pass to the Occlusion functions.
Can anyone give me some help on how to use the Occlusion functions?
Thanks in advance.