Flappy icon indicating copy to clipboard operation
Flappy copied to clipboard

I get an error when I try to flap

Open Kcoops97 opened this issue 9 years ago • 4 comments

Exception in thread "Game" org.lwjgl.system.libffi.ClosureError: Callback failed because the closure instance has been garbage collected. at org.lwjgl.glfw.GLFW.glfwPollEvents(Native Method) at com.example.kieran.SpaceHopper2.Main.update(Main.java:113) at com.example.kieran.SpaceHopper2.Main.run(Main.java:92) at java.lang.Thread.run(Unknown Source)

Kcoops97 avatar Jun 04 '15 01:06 Kcoops97

It's because the Input class with the glfw callback needs to be stored somewhere so it doesn't get garbage collected, you should create a property with type Input in the Main class, instanciate it, and assign it to the callback. That way, the instance of Input will be stored on memory and won't be collected by the gc

OctavioGalland avatar Aug 18 '15 03:08 OctavioGalland

@ochi12 is right. Do something like

private Input input = new Input();

And then use it in the glfwSetKeyCallback:

glfwSetKeyCallback(window, input);

This should fix the problem

gnuwilliam avatar Sep 07 '15 07:09 gnuwilliam

Muchas gracias me sirvió de mucha ayuda!!!

guillesolana avatar Apr 11 '16 01:04 guillesolana

I'm getting an issue. I had some problems with his tutorial as a lot of things are updated. So I decided to download the full code and update what I could. I've done so and now the game starts. But no pipes are loaded and there's an error:

Could not find uniform variable 'ml_matrix'! 1281 Could not find uniform variable 'top'!

Being printed out over and over again.

felixrichnow avatar Jun 28 '17 08:06 felixrichnow