Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QOpenGLWidget without using QOpenGLFunctions
QtWS25 Last Chance

Using QOpenGLWidget without using QOpenGLFunctions

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.5k Views
  • 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.
  • greenstrandG Offline
    greenstrandG Offline
    greenstrand
    wrote on last edited by
    #1

    Hi all,

    I manage a large desktop application written in OpenGL and Qt, and I'm currently transitioning from Qt4.8 to Qt5.5. I'm interested in using the QOpenGLWidget as a surface without needing to convert all of my existing graphics code to use a QOpenGLFunctions object (via subclassing or anything else); that is, I'd like to be able to continue using the global GL bindings.

    My question is this: does anyone have a working example of this or documentation that it cannot be done?

    My setup and issue:

    Under Qt4.8, I used the QGLWidget and GLEW, all GL calls were made within the widget's paintGL stack but by numerous subcomponents and utilities, and everything worked fine. After switching to Qt5.5, I wish to use to QOpenGLWidget both to avoid Qt's verbose warnings and also simply for good practice. I have no interest in using Qt's graphics utilities--QShaderProgram, etc--as we have our own; Qt is my windowing framework, not my graphics framework. Unfortunately, any gl*Framebuffer or gen*Buffer calls (and possibly more, but I haven't tested exhaustively) now segfault immediately, even though nothing has changed except for QGLWidget -> QOpenGLWidget.

    Things I've already tried:

    • I've made sure to eradicate the "qopenglfunctions doesn't work with glew" warning. No compilation unit includes both of them.
    • Within QOpenGLWidget, I've verified that it's context is current when my graphics calls are made
    • I've made sure that my code writes to the FBO held by the widget (not FBO 0)--not that execution gets that far
    • Using GDB, I've verified that my GL function pointers are the same in either case (Qt isn't mangling the bindings somehow)
    • I've checked that "context()->functions()->glGenFramebuffers()" (e.g.) does work, while "glGenFramebuffers()" does not
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      Few things to get out of the way.

      • Have you initialized GLEW, i.e. called glewInit() in QOpenGLWidget::initializeGL or anywhere else with current context?
      • Was a call to glewInit successful (returned GLEW_OK)?
      • Have you set a context version and have checked that the context you get is a version you requested? Are the missing functions present in the version you are getting?
      1 Reply Last reply
      0
      • M Offline
        M Offline
        mute
        wrote on last edited by
        #3

        Cached the same behaviour. Did you solved this? If yes could you please describe how.

        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