Created
January 10, 2023 14:32
-
-
Save jdolan/7f34c75faf8162c62677a86f184aeed9 to your computer and use it in GitHub Desktop.
Naive OpenGL Occlusion Query implementation (don't do this).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glBeginQuery(GL_ANY_SAMPLES_PASSED, query->name); | |
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, query->elements); // draw the AABB | |
glEndQuery(GL_ANY_SAMPLES_PASSED); | |
glGetQueryObjectiv(query->name, GL_QUERY_RESULT, &query->result); | |
if (query->result) { | |
// draw the object(s) the query was guarding | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment