I feel as though I understand what a context is. I’m having trouble finding information on how to work with them if anyone can help my understanding or answer any of these questions.
I have a main window. From that main window I spawn a new thread. I cannot pass the context from the original window to the new thread?
Contexts cannot be altered by different threads? I feel like I’ve seen it stated as possible for newer versions?
So then I need a new context for the new thread, yes?
Can you say the conceptual steps I need to transition as I describe?
That is: same window, switch from main screen context to game context.
What I’m doing is: Main window, make new game in another thread, that game object is loaded as the game for the new game launch.
I want the main window to then have the context of the game. This approach would seem to dictate it being possible to use a context between threads?
My specific current problem:
java.lang.IllegalStateException: No GLCapabilities instance set for the current thread. Possible solutions:
a) Call GL.createCapabilities() after making a context current in the current thread.
b) Call GL.setCapabilities() if a GLCapabilities instance already exists for the current context.
at org.lwjgl.opengl.GL.getCapabilities(GL.java:238)
at org.lwjgl.opengl.GL11.nglGenTextures(GL11.java:3009)
at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:3035)
I tried to import the original context. No go. So I tried to make a new context (same launch method as first window/context), that still returned this error. Made a different method for trying to properly do it and that still returned this same error.
I also tried various combinations of the following to no avail.
//glfwMakeContextCurrent(window);
//GL.createCapabilities();
//GL.setCapabilities(null);
//window = GLFW.glfwGetCurrentContext();
I learn best by seeing working examples, but I’ve not see any. Thank you for any help!