LWJGL Forum

Programming => OpenGL => Topic started by: fred_em on November 10, 2011, 16:05:37

Title: IllegalStateException: No context is current
Post by: fred_em on November 10, 2011, 16:05:37
Hi,

The following sample code works:


Display.create(); // create context with LWJGL

if (GLContext.getCapabilities().GL_AMD_debug_output)
{
   AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback(
      new AMDDebugOutputCallback.Handler()
      {
          public void handleMessage(final int id, final int category, final int severity, final String message)
  {
             [...]
          }
      }));
}


In my situation, I am not getting the GL context from Display.create().
The context is created and made active by another native library:



// The following call calls wglMakeCurrent().
SomeObject.someNativeMethodThatCallsWglMakeCurrent();

GLContext.useContext(someGlobalObject);

/*
At this point I *can* use LWJGL functions like glBindBuffer and so on.
However, AMDDebugOutput.glDebugMessageCallbackAMD() raises the following exception:

java.lang.IllegalStateException: No context is current.
at org.lwjgl.opengl.CallbackUtil.registerContextCallback(CallbackUtil.java:91)
at org.lwjgl.opengl.CallbackUtil.registerContextCallbackAMD(CallbackUtil.java:154)
at org.lwjgl.opengl.AMDDebugOutput.glDebugMessageCallbackAMD(AMDDebugOutput.java:80)

Why ?
*/



Any idea? I'm stuck.

Thanks,
Fred
Title: Re: IllegalStateException: No context is current
Post by: spasi on November 10, 2011, 18:46:15
Try the next nightly build, it should be fixed now.
Title: Re: IllegalStateException: No context is current
Post by: fred_em on November 17, 2011, 09:41:24
It works fine with LWJGL 2.8.2.
Thanks.