'No context error in Java, but the context is set immediately after window creation [closed]
I'm trying to make a game using LWJGL 3, but I get this error: No context is current or a function that is not available in the current context was called.
This error means that these methods were not called:
glfwMakeContextCurrent(window);
GL.createCapabilities();
However in my code, these are called immediately after window creation:
...
this.window = glfwCreateWindow(this.width, this.height, this.title, 0, 0);
if(this.window == NULL) {
throw new RuntimeException("Failed to create window");
}
glfwMakeContextCurrent(this.window);
GL.createCapabilities();
...
this.world = new World(256, 256, 64); // calls GL11.glGenLists
this.worldRenderer = new WorldRenderer(this.world);
this.player = new Player(this.world);
...
This throws the previously mentioned exception. How do I fix it?
Solution 1:[1]
GL11.glGenLists is deprecated. Switch to using the GLFW_OPENGL_COMPAT_PROFILE instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TheAwesome98 |
