Hello,
I followed the beginner guide of LWJGL3 but I am experiencing a problem I am not able to solve.
I always get the exception
Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread.I searched a bit on the internet and I found some "solutions" but they not worked for me.
I do not have multiple threads running.
I am running Linux 64Bit and here is the important code:
Here I make the OpenGL context for the thread.
private void pushFrame() {
try (MemoryStack memoryStack = MemoryStack.stackPush()) {
pWidth = memoryStack.mallocInt(1);
pHeight = memoryStack.mallocInt(1);
GLFW.glfwGetWindowSize(handle, pWidth, pHeight);
vidMode = userMonitor.getResolution();
centerWindow();
GLFW.glfwMakeContextCurrent(handle);
GLFW.glfwSwapInterval(1);
GLFW.glfwShowWindow(handle);
}
}
This method will be called in my game loop after the window was created.
So the glfwMakeContextCurrent method is called before the createCapabilities method.
public void loop() {
GL.createCapabilities();
GL11.glClearColor(0, 0, 0, 0);
clearFrameBuffer();
GLFW.glfwSwapBuffers(handle);
GLFW.glfwPollEvents();
}
If thats not enough for you i posted the whole code on ghostbin:
https://ghostbin.com/paste/r9ghgThanks for reading!