Qt and OpenGL problems



  • I'm using Qt Creator with OpenGL on Windows 7 to build a very simple project (to draw dots, lines, and triangles). First trouble I'm having that's throwing an error and not letting me build (on a project that I know worked before I wiped my computer about a month ago) is these two errors:

    @'glEnableVertexAttribArray' was not declared in this scope
    'glVertexAttribPointer' was not declared in this scope@

    I think I've written up my .pro file correctly:

    @QT += core gui opengl
    TARGET = firstProject
    TEMPLATE = app

    SOURCES += main.cpp
    glwidget.cpp

    HEADERS += glwidget.h

    OTHER_FILES +=
    std.vert
    std.frag

    LIBS += -L./lib -lglew32

    INCLUDEPATH += ./include@

    and I've included GL/glew.h, QtGui/QWidget, and QtOpenGL in my project. 'lib' and 'include' are two folders that include the glew libs and include files and glew32.dll is in the same folder with the rest of the source files. Any ideas?

    Another problem I'm having is that I'm suddenly getting a lot of warnings that GLEW is incompatible with and not to include QtOpenGL or QGLFunctions. If I take out QtOpenGL though, I get a whole heck of a lot more errors. What are these warnings trying to tell me and how can I fix them or approach them appropriately?

    Here is my github project if you'd like to look at the project in full: "https://github.com/xingped/qt-opengl/tree/master/CAP4720-HW2":https://github.com/xingped/qt-opengl/tree/master/CAP4720-HW2



  • I've had problems with glew myself and was able to work around it by making sure glew.h (actually gltools.h in my case) was before any qt opengl header files in my source. With multiple header files, this was surprisingly difficult, but it finally worked after some re-arranging.

    morris


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.