Hello,
I'm creating an application where lwjgl is started in a non-main thread. It shouldn't be a problem, right?
I use the following code: `
glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
if (!glfwInit()) {
System.err.println("Couldn't initialize glfw context. Using software renderer.");
enabled = false;
reportOpenGLStartupError(null, "glfwInit()");
return;
}
// get monitor's size to set max width / height
GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
maxWidth = videoMode.width();
maxHeight = videoMode.height();
// set current heights
int w = (int) (maxWidth * 0.7);
int h = (int) (maxHeight * 0.7);
if (w < 900)
w = 900;
if (h < 600)
h = 600;
Client.clientWidth = width = frameWidth = w;
Client.clientHeight = height = frameHeight = h;
// resizable and
glfwWindowHint(GLFW_RESIZABLE, 1);
glfwWindowHint(GLFW_VISIBLE, 0);
window = glfwCreateWindow(width, height, "Emps-World", 0, 0);
if (window == 0) {
enabled = false;
System.err.println("Couldn't initialize glfw window ("+width+"/"+height+"). Using software renderer.");
return;
}
// make current window current contest and create GL capabilities
glfwMakeContextCurrent(window);
GL.createCapabilities();
System.out.println("[GraphicsDisplay]: init(): current thread: "+Thread.currentThread().getName());
`
Now this works on both, my laptop and on my Desktop computer. However, on another Windows 10 setup it crashes with following exception:
java.lang.IllegalStateException: There is no OpenGL context current in the current thread.
Do I have something wrong? Calling glfwMakeContextCurrent(window); should bind the current thread to the current OpenGL Context?
Thanks in advance!
Thomy
Hello,
I'm creating an application where
lwjglis started in a non-main thread. It shouldn't be a problem, right?I use the following code: `
`
Now this works on both, my laptop and on my Desktop computer. However, on another Windows 10 setup it crashes with following exception:
java.lang.IllegalStateException: There is no OpenGL context current in the current thread.Do I have something wrong? Calling
glfwMakeContextCurrent(window);should bind the current thread to the currentOpenGL Context?Thanks in advance!
Thomy