Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. OpenGL 3.x functions
Forum Updated to NodeBB v4.3 + New Features

OpenGL 3.x functions

Scheduled Pinned Locked Moved Game Development
6 Posts 3 Posters 5.1k 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.
  • B Offline
    B Offline
    Babalas
    wrote on last edited by
    #1

    I'm attempting to integrate my 3.3 opengl codebase with QtQuick from Qt5. I suspect I'm going about this the wrong way. The issue I have is that using QOpenGLContext throws up these warnings when combined with GLEW:
    @#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
    #warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h@

    So I can't figure out how to mix Qt5 and GLEW together.

    One possible alternative I've found is to use QOpenGLContext::getProcAddress but then I would have to maintain all these functions myself. Is QOpenGLContext the wrong thing to use then? Do I stick with QGLWidget and QGLContext?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      The problem seems to be with having both GLEW and QtOpenGL includes in a same compilation unit. You could put all your rendering code that use GLEW in files (.cpp) that deal with the pure OpenGL side of things and wrap all that drawing code within objects on which you would just call a method @object->render();@ or something like that.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        You can #include <GL/glew.h> after the Qt OpenGL-related headers.

        I have a patch pending for Qt 5.1 which will remove the need to use GLEW with Qt5: https://codereview.qt-project.org/#change,35408 Unfortunately this missed the window for 5.0.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Babalas
          wrote on last edited by
          #4

          I went the route of placing the headers in different compilation units. Including GLEW after the Qt opengl headers didn't work because of GLEW complaining about having GL/gl.h included before GLEW.

          I saw the change to remove GLEW. The approach seems similar to GL3W. I'll be looking forward to that change.

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on last edited by
            #5

            Please feel free to cherry pick the above set of changes and take them for a spin. I am looking for feedback and testing. If you can try them out it would be much appreciated.

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Babalas
              wrote on last edited by
              #6

              Awesome, I'll give that a try tomorrow.

              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