rednblackgames/HyperLap2D

Lwjgl3 crash when i minimize the Window with an IllegalStateException

aallnneess opened this issue · 1 comments

Describe the bug
Lwjgl3 crash when i minimize the Window with an IllegalStateException:

Exception in thread "main" java.lang.IllegalStateException: Frame buffer couldn't be constructed: incomplete attachment
	at com.badlogic.gdx.graphics.glutils.GLFrameBuffer.build(GLFrameBuffer.java:256)
	at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:75)
	at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:57)
	at games.rednblack.editor.renderer.systems.render.FrameBufferManager.createFBO(FrameBufferManager.java:35)
	at games.rednblack.editor.renderer.systems.render.FrameBufferManager.createFBO(FrameBufferManager.java:20)
	at games.rednblack.editor.renderer.systems.render.HyperLap2dRenderer.resize(HyperLap2dRenderer.java:519)
	at games.rednblack.editor.renderer.SceneLoader.resize(SceneLoader.java:414)
	at games.rednblack.hyperlap2d.example.HyperLap2DExample.resize(HyperLap2DExample.java:134)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics$1.invoke(Lwjgl3Graphics.java:76)
	at org.lwjgl.glfw.GLFWFramebufferSizeCallbackI.callback(GLFWFramebufferSizeCallbackI.java:37)
	at org.lwjgl.system.JNI.invokeV(Native Method)
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3094)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:149)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:116)
	at games.rednblack.hyperlap2d.example.lwjgl3.Lwjgl3Launcher.createApplication(Lwjgl3Launcher.java:15)
	at games.rednblack.hyperlap2d.example.lwjgl3.Lwjgl3Launcher.main(Lwjgl3Launcher.java:11)

> Task :lwjgl3:Lwjgl3Launcher.main() FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 4 executed, 1 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lwjgl3:Lwjgl3Launcher.main()'.
> Process 'command 'C:/Program Files/Java/jdk1.8.0_271/bin/java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 46s
16:19:26: Task execution finished 'Lwjgl3Launcher.main()'.

To Reproduce
Steps to reproduce the behavior:

  1. Start a Lwjgl3 app and minimize
2021-03-27-16-19-23.mp4
fgnm commented

This is not really an hyperlap bug, but it's related to windows and LWJGL3. When you minimize the window GLFW fires a resize event with width and height = 0. This may cause additional problem in future, so I think that the best solution is to avoid call SceneLoader#resize when width or height are 0 (this is also good for performance because scene loader recreate FBOs when you call resieze).