I’m trying to move from GLee to glew, because GLee doesn’t work under VC2010 and hasn’t been updated in a while. I’m having trouble with the header files, because the both libs want their header file defined first. glew doesn’t like gl.h being defined first (which is defined in QtOpenGL), and QtOpenGL specifically states that glew should be defined after QtOpenGL.
Searching shows many people using both glew and Qt together just fine. At the very least, I’d like a definitive answer about the compatibility. I’ve added the .h and .c files to my project, because in future I won’t have to mess around installing .lib and .dll files.
Here’s the code in QtOpenGL that gets called if glew is included first:
#ifdef __GLEW_H__
#warning qglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
#warning To use GLEW with Qt, do not include <QtOpenGL> or <QGLFunctions> after glew.h
#endif
And here’s the code called if QtOpenGL is included first:
#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)
#error gl.h included before glew.h
#endif
GLEW and qtfunctions all define the same things. You can’t use them together, and you shouldn’t want to. All you’re using Qt for is to initialize the OpenGL context. So don’t include qtfunctions. Try to include just QGLWidget and the stuff that class needs.