I am trying to use GLEW with the new QOpenGLWidget (that appeared in Qt 5.4). While I could do that quite easily with the older QGLWidget, it seems that the new QOpenGLWidget / QOpenGLContext classes do not collaborate well with GLEW (and I have no choice, I am using an external library that uses GLEW). I have the following problems:
- there is a compile-time warning (in qopenglfunctions.h triggered when GLEW_H is defined), and I cannot avoid including qopenglfunctions.h since it is included by QOpenGLContext
- (not sure it is related) in my application, I got an OpenGL stack underflow
- (not sure it is related) in my application, when I try making an OpenGL context current, it results in a black window for the whole application (I have several QOpenGLWidgets in the application, and need to change context because I am using OpenGL color clipping)
I would like to get rid of the warnings to determine whether 2. and 3. are related with GLEW/QOpenGLWidget incompatibility.
Note: There are already several questions about Qt5/GLEW on Stackoverflow, but they all relate with the (older) QGLWidget, that behaves quite differently (no problem with this one with the same code/application).
The codebase is located here: https://gforge.inria.fr/frs/?group_id=1465 (too large to be included here, and because of the length, I cannot ask you to take a look at it, just in case you want to know)
I was able to fix all the problems as follows (yes !):