Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to use glew with Qt 4.8?
Forum Updated to NodeBB v4.3 + New Features

How to use glew with Qt 4.8?

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 5 Posters 14.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gonsor
    wrote on last edited by
    #1

    Hi,

    I am trying to use glew and Qt together, which worked fine with Qt 4.7. In 4.8 however it does not seem to be possible anymore. Including glew before QtOpenGL yields:

    @/usr/include/QtOpenGL/qglfunctions.h:46:2: warning: #warning qglfunctions.h is not compatible with GLEW, GLEW defines will be undefined [-Wcpp]
    /usr/include/QtOpenGL/qglfunctions.h:47:2: warning: #warning To use GLEW with Qt, do not include <QtOpenGL> or <QGLFunctions> after glew.h [-Wcpp]
    @
    and it later does not find functions like 'glUseProgram'. If I turn the includes around, the result is:
    @/usr/include/GL/glew.h:84:2: error: #error gl.h included before glew.h
    /usr/include/GL/glew.h:87:2: error: #error glext.h included before glew.h
    @

    I cannot find much information about how it would still be possible to use them together. I have a rather large codebase of platform independent c++ opengl code and I always used Qt for window/context creation etc on desktops. The dependency on glew is not necessary, if I could still call all gl* functions normally c style. The documentation of QGLFunctions indicates how to achieve this for the paintGL method only, which is obviously not enough.

    Is there still a way to use glew and Qt 4.8 together? Or to drop glew as explained above?

    Regards
    Daniel

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stante
      wrote on last edited by
      #2

      QGLFunctions has only support for OpenGL/ES 2.0 API functionality. For using functionality of the latest OpenGL API you should not include QtOpenGL because it include qglfunctions.h and yields to the error you described. If you want to use your custom OpenGL widget based on QGLWidget you can just include the glew header before QGLWidget.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        limdor
        wrote on last edited by
        #3

        I confirm what stante says. I use glew and Qt 4.8 and I just do:
        @#include "glew.h"
        #include <QGLWidget>@

        without QGLFuntions include.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KeithS
          wrote on last edited by
          #4

          Same here:
          @
          #include <GL/glew.h>
          #include <QGLWidget>
          #include <QGLFramebufferObject>
          #include <QGLPixelBuffer>
          #include <QGLBuffer>
          @
          works just fine in Qt 4.x

          [Edit: Added @ tags around code; mlong]

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mfeemster
            wrote on last edited by
            #5

            This has ceased working in Qt 5. QGLWidget automatically includes QGLFunctions, which blows away glew. This ought to be fixed.

            github.com/mfeemster/fractorium/wiki

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved