Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occlusion Query/Conditional Rendering #8

Open
gecko0307 opened this issue Sep 15, 2017 · 0 comments
Open

Occlusion Query/Conditional Rendering #8

gecko0307 opened this issue Sep 15, 2017 · 0 comments

Comments

@gecko0307
Copy link
Owner

gecko0307 commented Sep 15, 2017

Conditional rendering is an OpenGL 3.x feature. The main idea behind it is rendering a simple bounding volume for object (like AABB) and testing if any of it is actually visible on screen. If it is, then we can render the object itself, but if it isn't, then we can safely discard the expensive rendering.

// Initialization:
GLuint query;
glGenQueries(1​, &query​);

// Rendering:
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);
glBeginQuery(GL_SAMPLES_PASSED, query);
// render bounding volume of an object
glEndQuery(GL_SAMPLES_PASSED);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_TRUE);

glBeginConditionalRender(query, GL_QUERY_WAIT​);
// render an object
glEndConditionalRender();

Conditional rendering can be an optional feature of Entity. This will require an additional interface on top of Drawable which defines AABB property.

@gecko0307 gecko0307 changed the title Occlusion Query/Conditional Rendering [gl33] Occlusion Query/Conditional Rendering Sep 16, 2017
@gecko0307 gecko0307 changed the title [gl33] Occlusion Query/Conditional Rendering Occlusion Query/Conditional Rendering Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant