Using Qt with Gl3w
-
Hello,
I'm having issues with integrating my qt project with gl3w, my plan was to build an external game editor for my game. I saw online that someone said that it is possible create the opengl context only from qt and use gl3w and normal opengl functions to render their scene. But when I included gl3w.h into my Qt project, there was a redefinition error as stated below:
error C2371: 'PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC' : redefinition; different basic types
Hope someone can help me with my issue. Thank you very much
-
Hi and welcome to devnet,
With Qt 5 you don't need Glew at all, you have everything needed there with e.g. QOpenGLFunctions
-
@SGaist My plan was to integrate my game engine within the editor so that I can use of some its functions when I'm building the game level. Is there any way around my issue? Or would be it preferable for me to use Qt's OpenGL classes instead?
-
One thing you can try is to isolate your use of glew from your use of Qt
-
Make sure
gl3w.h
is included before any Qt OpenGL headers like QOpenGLWidget or whatever you're using.Here's a sample that you can try out that works for me. Should start an empty window and print GL version to debug output:
#include "GL/gl3w.h" #include <QApplication> #include <QOpenGLWidget> #include <QDebug> struct MyGl : public QOpenGLWidget { MyGl() {} void initializeGL() { gl3wInit(); qDebug() << (char*)gl3wGetString(GL_VERSION); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MyGl gl; gl.show(); return a.exec(); }