3.1.5 8Ubuntu Linux 16.04 LTS / EGL / nVidia driver 384.98GL.javaThis bug appeared after updating nVidia driver from 384.90 to 384.98
This exception is thown:
Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread.
at org.lwjgl.opengl.GL.createCapabilities(GL.java:363)
at org.lwjgl.opengl.GL.createCapabilities(GL.java:312)
...
Seems that this statement returns false, maybe because majorVersion is reported to be 0 (instead of 4)
if (JNI.callI(GetError) == 0 && 3 <= (majorVersion = version.get(0)))
In create() I see for LINUX only glXGetProcAddress or glXGetProcAddressARB being used. I would expect that eglGetProcAddress if the context was created using EGL.
My context creation looks like this that crashes at GL.createCapabilities():
public EglContext() {
// get default display
this.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
// initialize EGL
// https://devblogs.nvidia.com/parallelforall/egl-eye-opengl-visualization-without-x-server/
int[] major = new int[1];
int[] minor = new int[1];
if (!eglInitialize(this.display, major, minor))
throw new RuntimeException("Could not initialize EGL");
try (MemoryStack stack = stackPush()) {
// bind OpenGL api
eglBindAPI(EGL_OPENGL_API);
// select configuration
int[] configAttribs = new int[] {
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_NONE};
PointerBuffer configs = stack.mallocPointer(1);
int[] numConfigs = new int[1];
eglChooseConfig(this.display, configAttribs, configs, numConfigs);
if (numConfigs[0] < 1)
throw new RuntimeException("Could not find a suitable EGL configuration");
// create a context and make it current
this.context = eglCreateContext(this.display, configs.get(0), EGL_NO_CONTEXT, (IntBuffer)null);
eglMakeCurrent(this.display, EGL_NO_SURFACE, EGL_NO_SURFACE, this.context);
}
// activate extensions and check if required extensions are supported
GLCapabilities capabilities = GL.createCapabilities();
}
I found a solution. Before GL.createCapabilities(), to use eglGetProcAddress instead of glXGetProcAddress as function provider I do
Configuration.OPENGL_EXPLICIT_INIT.set(true);
GL.create(EGL.getFunctionProvider());
Most helpful comment
I found a solution. Before GL.createCapabilities(), to use eglGetProcAddress instead of glXGetProcAddress as function provider I do
Configuration.OPENGL_EXPLICIT_INIT.set(true); GL.create(EGL.getFunctionProvider());