lwjgl 3 and native functions loading

Started by Kai, October 28, 2014, 16:11:28

Previous topic - Next topic



I was just testing lwjgl3 together with SWT a little bit more *without* OpenCL initialization first, and I cannot get it working.
What I did was, I created a SWT GLCanvas, set its managed GL context current in the invoking thread and tried to call GLContext glCtx = GLContext.createFromCurrent();
This call fails with:
java.lang.UnsatisfiedLinkError: org.lwjgl.system.windows.WGL.wglGetCurrentContext()J

When I include a call to CL.create() as the very first invocation, everything is okay and I can render with OpenGL just fine.

Apparently, lwjgl3 does not load native JNI functions from the native library when invoking GLContext glCtx = GLContext.createFromCurrent(); but somehow it does so when invoking CL.create();

What initialization method do I have to invoke in order to let lwjgl load the native functions?



As a temporary workaround, try calling Sys.touch() before GLContext.createFromCurrent(). In the future, I'll make sure all useful "entry points" properly trigger LWJGL's initialization.