LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: No OpenGL context found in libGDX on game restart  (Read 761 times)

tufflax

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
No OpenGL context found in libGDX on game restart
« on: March 31, 2017, 05:17:19 »

Hi!

I'm on a quest to figure out why I can't restart my game (quit and make a new LwjglApplication class instance) in libGDX in the same JVM process, i.e. without quitting Java. (The reason I want to do that is because I use Clojure, and having to restart the JVM every time I want to try something out is a complete deal breaker.) I get the following error.

Code: [Select]
Exception in thread "LWJGL Application" java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at org.lwjgl.opengl.GL11.glViewport(GL11.java:3261)
at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glViewport(LwjglGL20.java:839)

To be clear, this is the error one gets when trying to restart the game the third time. The second time it does start up again, but with a few problems, one of them being the screen/viewport/window size is not what it should be.

Now the libGDX guys blamed you, at least back in 2012: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=4802&p=22988&hilit=restart+jvm#p22988

It's not exactly the same error, but it seems to be related; error in glViewport when trying to restart a game.

Do you guys know what's going on here? I don't know much about OpenGL so I don't really know how to phrase my questions. A notable thing is that in jMonkeyEngine, also using LWJGL, one can make new Application class instances, i.e. restart the game. I wish I knew what to say to/what to do in libGDX to make this work.
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: No OpenGL context found in libGDX on game restart
« Reply #1 on: March 31, 2017, 12:28:18 »

Have you tried using the lwjgl3 back end?
Logged

tufflax

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Re: No OpenGL context found in libGDX on game restart
« Reply #2 on: March 31, 2017, 16:21:16 »

Have you tried using the lwjgl3 back end?

No, I have not. They say it's not finished, but I can of course try. So, are you saying there is a problem with lwjgl2? Is there no way I can avoid it? I would like to know more about the problem, if you know what the issue is.
Logged