From b6b0f743fb026ccd961c16c812f049599cd385da Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:26:11 +1000 Subject: [PATCH] Fix translucents --- .../voxy/client/core/rendering/post/PostProcessing.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/post/PostProcessing.java b/src/main/java/me/cortex/voxy/client/core/rendering/post/PostProcessing.java index 93706f35..42ffca41 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/post/PostProcessing.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/post/PostProcessing.java @@ -24,6 +24,7 @@ import static org.lwjgl.opengl.GL45C.glBlitNamedFramebuffer; public class PostProcessing { private final GlFramebuffer framebuffer; + private final GlFramebuffer framebufferSSAO; private int width; private int height; private GlTexture colour; @@ -46,6 +47,7 @@ public class PostProcessing { public PostProcessing() { this.framebuffer = new GlFramebuffer(); + this.framebufferSSAO = new GlFramebuffer(); } public void setSize(int width, int height) { @@ -67,6 +69,10 @@ public class PostProcessing { this.framebuffer.bind(GL_COLOR_ATTACHMENT0, this.colour); this.framebuffer.bind(GL_DEPTH_STENCIL_ATTACHMENT, this.depthStencil); this.framebuffer.verify(); + + this.framebufferSSAO.bind(GL_COLOR_ATTACHMENT0, this.colourSSAO); + this.framebufferSSAO.bind(GL_DEPTH_STENCIL_ATTACHMENT, this.depthStencil); + this.framebufferSSAO.verify(); } } @@ -74,6 +80,7 @@ public class PostProcessing { public void shutdown() { this.framebuffer.free(); + this.framebufferSSAO.free(); if (this.colourSSAO != null) this.colourSSAO.free(); if (this.colour != null) this.colour.free(); if (this.depthStencil != null) this.depthStencil.free(); @@ -139,6 +146,8 @@ public class PostProcessing { GL11C.glBindTexture(GL_TEXTURE_2D, this.colour.id); glDispatchCompute((this.width+31)/32, (this.height+31)/32, 1); + + glBindFramebuffer(GL_FRAMEBUFFER, this.framebufferSSAO.id); }