There is no OpenGL context current in the current thread.

Started by elect, July 23, 2015, 07:50:59

Previous topic - Next topic

elect

Simple program, everything in a class, here

I know jogl, but I wanted to give a try to lwjgl and so I started writing it from the hello word in order to minimize problems..

As you can see, glfwMakeContextCurrent() is called before all the various initializations (porgrams, textures, targets, vbo, vao)

But I still get this exception

QuoteGlCallsOverheads 3.0.0a!
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.GL20.getInstance(GL20.java:372)
   at org.lwjgl.opengl.GL20.glCreateShader(GL20.java:469)
   at lwjgl.glsl.ProgramBase.loadShader(ProgramBase.java:55)
   at lwjgl.glsl.ProgramBase.<init>(ProgramBase.java:26)
   at lwjgl.GlCallsOverhead.initPrograms(GlCallsOverhead.java:137)
   at lwjgl.GlCallsOverhead.init(GlCallsOverhead.java:109)
   at lwjgl.GlCallsOverhead.run(GlCallsOverhead.java:49)
   at lwjgl.GlCallsOverhead.main(GlCallsOverhead.java:320)
Java Result: 1

spasi

Hey elect,

You need to move GLContext.createFromCurrent() from line 273 to somewhere between glfwMakeContextCurrent(window) and initPrograms(). It must be called before any OpenGL function is used.

elect

Quote from: spasi on July 23, 2015, 07:59:04
Hey elect,

You need to move GLContext.createFromCurrent() from line 273 to somewhere between glfwMakeContextCurrent(window) and initPrograms(). It must be called before any OpenGL function is used.

Thanks Spasi, it worked