0

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();
}
Community
  • 1
  • 1
DragonautX
  • 860
  • 1
  • 12
  • 22
  • http://stackoverflow.com/questions/5902200/how-to-open-black-consoleoutput-window-in-windows-form-application-in-visual-s – Ripi2 Mar 13 '17 at 22:36
  • @Ripi2 Putting `AllocConsole()` in the start of `main()` didn't work. And output window doesn't have the error messages, only the build status. Do you have any other ideas? – DragonautX Mar 13 '17 at 23:40
  • Have you tried the second answer in that post? – Ripi2 Mar 14 '17 at 00:05
  • @Ripi2 Ya. The output and immediate window are both on the bottom of the VS ui. They're just both blank when I try to Start w/o Debugging. The error I'm trying to look at is only in the black console that disappears after showing the error. – DragonautX Mar 14 '17 at 01:42

0 Answers0