I'm trying out a first-time application using freeglut and OpenGL on VS 2015. I'm able to build with no errors. But when I Ctrl+F5 to Start Without Debugging, some error appears on the console, and then the console closes. How can I keep this console window open so I can read the error?
From this post, I tried using std::cin.get
and a breakpoint at the end of my main function, but the console still closes. I can sort of see that the error has some text like "Unable to create OpenGl 4.3 context".
I found that glutInitContextVersion(4,3)
was the problem (my OpenGL version is only 4.0). I'm still wondering if it's possible to keep the window open when a function raises an error like this.
Here's the main function of the sample app if it helps:
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitContextVersion(4, 3);
glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("square.cpp");
glutDisplayFunc(drawScene);
glutReshapeFunc(resize);
glutKeyboardFunc(keyInput);
glewExperimental = GL_TRUE;
glewInit();
setup();
glutMainLoop();
}