From 9fe6618cc9654f55aa2572c514e68be2f9e3e7cb Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 4 Aug 2023 12:53:44 +0900 Subject: [PATCH] fix: splash goes black when hq2x is enabled --- src/net/torvald/terrarum/App.java | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/net/torvald/terrarum/App.java b/src/net/torvald/terrarum/App.java index 5dd385eda..064d20904 100644 --- a/src/net/torvald/terrarum/App.java +++ b/src/net/torvald/terrarum/App.java @@ -242,8 +242,6 @@ public class App implements ApplicationListener { public static Hq2x hq2x; public static Mesh fullscreenQuad; - public static Mesh fullscreenQuad2x; - public static Mesh fullscreenQuadHQnX; private static OrthographicCamera camera; private static FlippingSpriteBatch logoBatch; public static TextureRegion logo; @@ -484,21 +482,7 @@ public class App implements ApplicationListener { VertexAttribute.ColorUnpacked(), VertexAttribute.TexCoords(0) ); - fullscreenQuad2x = new Mesh( - true, 4, 6, - VertexAttribute.Position(), - VertexAttribute.ColorUnpacked(), - VertexAttribute.TexCoords(0) - ); - fullscreenQuadHQnX = new Mesh( - true, 4, 6, - VertexAttribute.Position(), - VertexAttribute.ColorUnpacked(), - VertexAttribute.TexCoords(0) - ); updateFullscreenQuad(fullscreenQuad, scr.getWidth(), scr.getHeight()); - updateFullscreenQuad(fullscreenQuad2x, scr.getWidth() * 2, scr.getHeight() * 2); - updateFullscreenQuad(fullscreenQuadHQnX, Math.round(scr.getWf() * 1280f / 2028f), Math.round(scr.getHf() * 720f / 982f)); // set up renderer info variables renderer = Gdx.graphics.getGLVersion().getRendererString(); @@ -578,14 +562,18 @@ public class App implements ApplicationListener { if (getConfigString("screenmagnifyingfilter").equals("hq2x") ) { FrameBufferManager.begin(postProcessorOutFBO2); - hq2x.renderToScreen(postProcessorOutFBO.getColorBufferTexture()); + shaderPassthruRGBA.bind(); + shaderPassthruRGBA.setUniformMatrix("u_projTrans", camera.combined); + shaderPassthruRGBA.setUniformi("u_texture", 0); + hq2x.renderToScreen(postProcessorOutFBO.getColorBufferTexture()); FrameBufferManager.end(); shaderPassthruRGBA.bind(); + shaderPassthruRGBA.setUniformMatrix("u_projTrans", camera.combined); shaderPassthruRGBA.setUniformi("u_texture", 0); postProcessorOutFBO2.getColorBufferTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); postProcessorOutFBO2.getColorBufferTexture().bind(0); - fullscreenQuadHQnX.render(shaderPassthruRGBA, GL20.GL_TRIANGLES); + fullscreenQuad.render(shaderPassthruRGBA, GL20.GL_TRIANGLES); } else if (getConfigDouble("screenmagnifying") < 1.01 || getConfigString("screenmagnifyingfilter").equals("none")) { shaderPassthruRGBA.bind(); @@ -756,8 +744,6 @@ public class App implements ApplicationListener { if (currentScreen != null) currentScreen.resize(scr.getWidth(), scr.getHeight()); TerrarumPostProcessor.INSTANCE.resize(scr.getWidth(), scr.getHeight()); updateFullscreenQuad(fullscreenQuad, scr.getWidth(), scr.getHeight()); - updateFullscreenQuad(fullscreenQuad2x, scr.getWidth() * 2, scr.getHeight() * 2); - updateFullscreenQuad(fullscreenQuadHQnX, Math.round(scr.getWf() * 1280f / 2028f), Math.round(scr.getHf() * 720f / 982f)); if (renderFBO == null || @@ -830,8 +816,6 @@ public class App implements ApplicationListener { CommonResourcePool.INSTANCE.dispose(); fullscreenQuad.dispose(); - fullscreenQuad2x.dispose(); - fullscreenQuadHQnX.dispose(); logoBatch.dispose(); batch.dispose(); // shapeRender.dispose();