dimanche 15 mars 2015

Code after glfwTerminate() never runs


I've been trying some modern OpenGL tutorials, and I came across what seems to be strange behaviour. Here is the code, reduced to its (almost) bare essentials.



#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>

using std::cout;
using std::endl;

int main(){
std::cout << "Begin program" << std::endl;
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", 0, 0); // Windowed
glfwMakeContextCurrent(window);
glewExperimental = GL_TRUE;
glewInit();

while(!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
cout << "before glfwTerminate()" << endl;
glfwTerminate();
cout << "after glfwTerminate()" << endl; cout.flush();

std::cout << "End program" << std::endl;
return 0;
}


Looking at the GLFW docs, the call to glfwTerminate() should not exit the program, but nothing is output to the console after "before glfwTerminate()" and the program ends.


I'm on ArchLinux (freshly updated) and I tried with both xfce4 and KDE (minimal install for the latter, just to make sure it wasn't an xfce4 issue).


Would someone have a hint as to what is going on?




Aucun commentaire:

Enregistrer un commentaire