A
A
Alexander Interesting2021-10-26 19:00:05
Java
Alexander Interesting, 2021-10-26 19:00:05

Why is the No context is current or a function that is not available in the current context was called error thrown?

I am using JWJGL and I get an error:

FATAL ERROR in native method: Thread[main,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
  at org.lwjgl.opengl.GL11.glMatrixMode(Native Method)
  at ru.REStudios.core.engine.Window.init(Window.java:100)
  at ru.REStudios.core.engine.GameEngine.init(GameEngine.java:39)
  at ru.REStudios.core.engine.GameEngine.run(GameEngine.java:31)
  at ru.REStudios.core.game.Main.main(Main.java:19)


In most cases, programmers get an error that is repaired if you add
GL.createCapabilities()
either but I have these two operators right before calling methods:
glfwMakeContextCurrent(long)
glfwMakeContextCurrent(windowHandle);
GL.createCapabilities();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -50.0f);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question