1

I'm using the LWJGL 3 'working' demo (http://www.lwjgl.org/guide).

I'm getting an error on glClearColor:

Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread.
at org.lwjgl.opengl.GL.getCapabilities(GL.java:164)
at org.lwjgl.opengl.GL11.getInstance(GL11.java:1388)
at org.lwjgl.opengl.GL11.glClearColor(GL11.java:1828)
at me.harrysmc.jgame.HelloWorld.loop(HelloWorld.java:98)
at me.harrysmc.jgame.HelloWorld.run(HelloWorld.java:28)
at me.harrysmc.jgame.HelloWorld.main(HelloWorld.java:114)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Even though as you see in the demo there is 'GL.createCapabilities(true)' and 'glfwMakeContextCurrent(window)'

Tried relevant answers on other questions.

1 Answers1

3

I just had the exact same problem, and i solved it by adding GLContext.createFromCurrent(); to init().

From this answer: https://stackoverflow.com/a/28133516/4080745

Community
  • 1
  • 1
rerennnn
  • 56
  • 6