Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] How do I get Qt Creator to support more (or less?) recent OpenGL versions?



  • I'm porting to Qt some code that I used to compile under MSVC++. I get errors that certain OpenGL functions and constants are not defined, like the following:

    error: 'GL_FUNC_ADD' was not declared in this scope

    error: 'glBlendEquation' was not declared in this scope

    Other OpenGL identifiers cause no problem, so it's not a question of me forgetting the include or the OpenGL module.

    I know glBlendEquation was an extension at one point, but that was many years ago; it should be part of the standard by now. How do I get Qt to use a more recent OpenGL API?

    Or maybe glBlendEquation is deprecated now. How do I get Qt to use a less recent API? Or is Qt using OpenGL ES?

    Thank you for considering my questions.



  • I don't think this has anything to do with Qt. Are you correctly adding the needed includes?



  • I'm using #include <QtOpenGL>. As I already mentioned, other OpenGL identifiers (such as glBlendFunc) do not cause compiler errors, so it appears that Qt is providing a different version of the OpenGL API than the one I want.



  • Qt is not providing any OpenGL API -- it just #includes the OpenGL headers. I think Microsoft's gl.h is missing glBlendEquation. Can you check that?



  • If the system's OpenGL headers does not provide access to some part of the OpenGL API, then you have to use an OpenGL extension manager (like "GLEW":http://www.opengl.org/sdk/libs/GLEW/ or "GLEE":http://www.opengl.org/sdk/libs/GLee/). It appears that in the upcoming Qt 4.8, you may also use "QGLFunctions":http://doc.qt.nokia.com/4.8-snapshot/qglfunctions.html.



  • I tried using GLEW, because I was using that in the original MSVC project, but I kept getting linker errors no matter what I tried.

    Today I downloaded GLee and included the source code in my project. The compiler errors are gone!


Log in to reply