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

GL30: Use MRT FBO for Water refractions on gl30 #186

Merged
merged 2 commits into from
Jun 16, 2023
Merged

Conversation

JamesTKhan
Copy link
Owner

@JamesTKhan JamesTKhan commented Jun 7, 2023

This is the first GL30 addition to Mundus. If GL30 is enabled/available, water refraction FBO uses MRT to attach a depth texture. This removes the need for an additional depth render pass for water refractions meaning less vertices, draw calls, and shader switches per frame.

GL20 behavior remains the same.

@@ -158,7 +163,7 @@ public void render(float delta) {
modelCacheManager.update(delta);

if (sceneGraph.isContainsWater()) {
captureDepth(delta);
if (Gdx.gl30 == null) captureDepth(delta);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing: You can use Gdx.graphics.isGL30Available(). Maybe this is a bit more elegant then a null check.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it does the exact same thing (checks if gl30 is null) but its alot more verbose. I guess the readability is better though

Copy link
Owner Author

@JamesTKhan JamesTKhan Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, made the change. I also changed it so that Scene uses Nestable FBOs as well. When I originally added these in, I only needed them on the EditorScene due to editor using FBOs too. But, for those wanting to do post processing at runtime, we should use NestableFrameBuffer on Scene as well and now don't have to update FBO code in two places.

@JamesTKhan JamesTKhan merged commit 2441c15 into master Jun 16, 2023
@JamesTKhan JamesTKhan deleted the water-mrt-fbo branch June 16, 2023 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants