Qt5 OpenGL sanity check
just started updating all my OpenGL demos to Qt 5 and want to check a few things I can't find documented.
In Qt4 the initializeGL function is called once after the ctor, and I usually use this to setup my basic GL state. In the new version we have some code that checks if the state has been created then calls the init function (as in "this":http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html example)
I'm trying to create a simpler version as an example for my students and it seems that we don't have a valid OpenGL context until the .show() method is called for the window which means I either have to use an if statement in the render function to setup my basic GL state or do something like this
@ OpenGLWindow window;
// and set the OpenGL format
// set the window size
// and finally show
// the context is only active once we show so now we can setup GL stuff
The code in the Window ctor is
m_context = new QOpenGLContext(this);
I would assume that create would have a valid context and the make current would allow me to do (in immediate mode GL) something like
However unless I do a show() this is not accepted, also if I do a show() followed by a call to my initialise() function that does the lookAt code I get a brief flash of the old window then the lookat version.
hope this all makes sense if anyone can tell me the proper way of doing things (I was hoping of avoiding the branch shown in the demo and having the needsInitialize code)