Skip to content

Commit

Permalink
Fix post-processing rendering causing a crash on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
kiooeht committed Jul 7, 2022
1 parent e0fd4f0 commit ce6772c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,3 +900,5 @@ This is a fast forward to v1.6.3 of daviscook477's fork with a few additional ch
* Add safety checks to post-processing initialization (kiooeht)

#### dev ####
* Fix post-processing blend function to not apply alpha again (kiooeht)
* Fix post-processing rendering causing a crash on Mac (kiooeht)
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public int[] Locate(CtBehavior ctBehavior) throws Exception {
}

public static void BeforeSpriteBatchEnd(SpriteBatch sb, OrthographicCamera camera) {
if (failedInitialized) {
if (failedInitialized || primaryFrameBuffer == null) {
return;
}

sb.end();
primaryFrameBuffer.end();

Expand Down Expand Up @@ -134,16 +134,16 @@ private static void initFrameBuffer() {
int width = Gdx.graphics.getWidth();
int height = Gdx.graphics.getHeight();

primaryFrameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true, true);
primaryFrameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false, false);
primaryFboRegion = new TextureRegion(primaryFrameBuffer.getColorBufferTexture());
primaryFboRegion.flip(false, true);

secondaryFrameBuffer = new FrameBuffer(Pixmap.Format.RGB888, width, height, true, true);
secondaryFrameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false, false);
secondaryFboRegion = new TextureRegion(secondaryFrameBuffer.getColorBufferTexture());
secondaryFboRegion.flip(false, true);
} catch (Exception e) {
failedInitialized = true;
e.printStackTrace();
System.out.println(e.getMessage());

if (primaryFrameBuffer != null) {
primaryFrameBuffer.dispose();
Expand All @@ -155,6 +155,8 @@ private static void initFrameBuffer() {
secondaryFrameBuffer = null;
secondaryFboRegion = null;
}

e.printStackTrace();
}
}

Expand Down

0 comments on commit ce6772c

Please sign in to comment.