PDA

View Full Version : OpenGL window flashes then closes



walshy1112
12-28-2014, 08:35 AM
I have create an OpenGl window with GLFW but when i run it the window opens and then isntantly closes is this something to do with my hardware not supporting a certain opengl version?

mhagain
12-28-2014, 08:54 AM
No, it's a bug in your own code. That's the first thing you should always assume when you get incorrect behaviour: that your own code is at fault.

walshy1112
12-28-2014, 09:01 AM
Its source code is from a website of a book so I would have presumed it was bug free if others could run it

GClements
12-28-2014, 10:24 AM
I have create an OpenGl window with GLFW but when i run it the window opens and then isntantly closes is this something to do with my hardware not supporting a certain opengl version?

Quite possibly. The code in question (6th edition SuperBible) requires at least OpenGL 4.1, possibly later. The website (http://www.openglsuperbible.com/example-code/) states that some of the examples won't work on OSX 10.9 due to it "only" supporting 4.1. The commit messages for the GitHub repository (https://github.com/openglsuperbible/sb6code) indicate that some of the shaders had their version downgraded to 410 for this reason, but it's unclear whether all of the examples now work with 4.1, or whether any of them will work with an older version.

You can probably find out exactly why the application fails by either running it from a command prompt (if the program has to create its own console window, it will close when the program terminates), or running it under a debugger and single-stepping through the initialisation.

walshy1112
12-28-2014, 11:26 AM
Thank you GClements im guessing that is it I checked my opengl supported versionswith openglev and 3.1 is my supported verisons so i guess ill get a book on that version. Thank you :)