Important: Please read the Qt Code of Conduct -

Qt5.0 OpenGL Types and ES #define[Solved]

  • Hi,

    I am porting over my OpenGL application written with Qt 4.8.1 to Qt 5.0, the latter of which I compiled from source for both x86 and x86-64. The application uses OpenGL 2 and GLEW. I am developing on Windows 7 x64.

    After changing over the #include-s, I ran into problems. It seems that "QT_OPENGL_ES_2" is defined, so that in the file "qtbase/src/opengl/qgl.h", it will eventually include "qtbase/src/3rdparty/angle/include/gles2/gl2.h". The problem is that this file defines a number of things that GLEW already defines (e.g. "GLintptr"). In that first file, something similar happens with "typedef GLfloat GLdouble;"

    All this seems very strange, as I don't (think?) I'm having Qt use OpenGL ES. After some groveling around in the sources and my compiler, the culprit seems to be "qtbase/src/corelib/global/qconfig.h", lines 124-128, which will define QT_OPENGL_ES_2 when it's not available, even if QT_NO_OPENGL_ES_2 has been defined. Something similar happens immediately above for QT_OPENGL_ES.

    So . . . any thoughts?


  • The released Qt5 binaries use ANGLE on windows which provides OpenGL ES implemented on top of DirectX. To be able to use your desktop OpenGL implementation build Qt5 yourself using -opengl desktop as part of the configure options.

    This should also be fixed for Qt 5.0.1 by also providing a desktop OpenGL build.

  • Doing so fixes that problem. Thanks!

Log in to reply