lwjglgamedev / lwjglbook-leg

Source code of the chapters of the book 3D Game Development with LWJGL 3

Home Page:https://ahbejarano.gitbook.io/lwjglgamedev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FATAL ERROR in native method error due to renderCrossHair

Paragoumba opened this issue · comments

In the following code:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
if (opts.compatibleProfile) {
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
} else {
        // Here
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
}

If the else block is executed, an exception is thrown when the renderCrossHair function call the LWJGL's glPushMatrix native function. The exception is due to the fact that glPushMatrix is not available in compat mode.
Error message: No context is current or a function that is not available in the current context was called