Hello it took me two days to figure out why my window always closed instand.
It was because i called gladLoadGL(glfwGetProcAddress) before glfwMakeContextCurrent(window).
This does NOT work:
int main() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
gladLoadGL(glfwGetProcAddress);
GLFWwindow * window = glfwCreateWindow(600, 600, "agag", NULL, NULL);
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window)) {
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.2f, 0.5f, 0.6f, 1);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
}
But when i call gladLoadGL(glfwGetProcAddress); AFTER glfwMakeContextCurrent(window); it DOES work!
Do i have load glad everytime i am switching the window? (maybe later i have to) But is it really like that or is it a bug?
When i write it before glfwMakeContextCurrent the error:
-1073741819 (0xC0000005)
comes up.