I am adding OpenGL support to a game based on Qt 3 (office policy). The basics (QGLWidget, etc.) are working fine.
To get to the OpenGL extensions, I arbitrarily chose GLee (it was compiled out of the box, GLew did not).
GLee.h and qgl.h do not play well together. AFAICT, each must be included in front of the other.
I checked the preprocessing checks [that made sure it was turned on first] from GLee.h, inserted preprocessor directives into it before including OpenGL headers, and then turned on qgl.h first. On linux, it boils down to:
#define __glext_h_
#define __glxext_h_
#define GLX_GLXEXT_PROTOTYPES
#include <qgl.h>
#include "GLee.h"
It builds (I don’t know if my code will actually run ... this question is proactive [ie I put off]), but it seems like a terrible kludge. A lot of people appeared in Googling asking this basic question (although most of them did not bother to figure out the errors of the fake compilers so that they could see the problem with the root), but I did not see the real answers.
Is there a better (more elegant, portable, reliable, etc.) way to do this?
James source
share