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. Opengl contexts agl, wgl, glx
Forum Updated to NodeBB v4.3 + New Features

Opengl contexts agl, wgl, glx

Scheduled Pinned Locked Moved General and Desktop
5 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.
  • P Offline
    P Offline
    piciji
    wrote on last edited by
    #1

    Hi,

    Is it possible to create own opengl contexts which hooks in a normal QT widget instead of using a QGLWidget. I want to make the display drivers independent from the toolkit.

    Thanks in advance

    1 Reply Last reply
    0
    • P Offline
      P Offline
      piciji
      wrote on last edited by
      #2

      I have tried it. My opengl code works within a QGLWidget but not by generating an own agl context (Mac). I don't get a error message. I think the problem is the binding of a standard widget with the agl context. I am using widget->winID(). Is there another way doing this? The winID() works for a directx context.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        minimoog77
        wrote on last edited by
        #3

        I have never tried on Mac, but it's possible to create QWidget with own OpenGL context.

        You must set QWidget attributes:

        @setAutoFillBackground(false);
        setAttribute(Qt::WA_OpaquePaintEvent);
        setAttribute(Qt::WA_NoSystemBackground);
        setAttribute(Qt::WA_NativeWindow);
        setAttribute(Qt::WA_PaintOnScreen, true);
        setAttribute(Qt::WA_StyledBackground, false);
        setAttribute(Qt::WA_PaintUnclipped);@

        Override QWidget::paintEvent and do nothing in that event.

        When creating context you will need native window handle (this is code for EGL on X11, so I don't how to create GL context on Mac):

        @eglDisplay = eglGetDisplay((EGLNativeDisplayType)x11Info().display());
        eglInitialize(eglDisplay, &majorVersion, &minorVersion);
        // all other create context stuff...@

        Hope this helps.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jmacey
          wrote on last edited by
          #4

          See this post for doing it on the mac (this is specific to setting Lion OpenGL core profile 3.2) but it should work for other context just change the code, the post from mcdi half way down is what I used

          https://qt-project.org/forums/viewthread/8047/

          1 Reply Last reply
          0
          • P Offline
            P Offline
            piciji
            wrote on last edited by
            #5

            Thank you, but I have decided for a QGLWidget.

            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