Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OPENGL ARB_occlusion_query Occlusion Culling

for (int i = 0; i < Number_Of_queries; i++)
{
    glBeginQueryARB(GL_SAMPLES_PASSED_ARB, queries[i]);

    Box[i]

    glEndQueryARB(GL_SAMPLES_PASSED_ARB);
}

I'm curious about the method suggested in GPU GEMS 1 for occlusion culling where a certain number of querys are performed. Using the method described you can't test individual boxes against each other so are you supposed to do the following?

Test Box A -> Render Box A

Test Box B -> Render Box B

Test Box C -> Render Box C

and so on...

like image 789
Dave Avatar asked Nov 04 '22 23:11

Dave


1 Answers

I'm not sure if I understand you correctly, but isn't this one of the drawbacks of the naive implementation of first rendering all boxes (and not writing to depth buffer) and then using the query results to check every object? But your suggestion to use the query result of a single box immediately is an even more naive approach as this stalls the pipeline. If you read this chapter (assuming you refer to chapter 29) further, they present a simple technique to overcome the disadvantages of both naive approaches (that is, just render everything normally and use the query results of the previous frame).

like image 131
Christian Rau Avatar answered Nov 11 '22 04:11

Christian Rau