Congratulations to our 2022 Qt Champions!

QGLWidget with custom OpenGL context

  • Hello,

    I'm trying to have my custom context creation works with QGLwidget, by creating a custom QGLContext.

    But I'm facing a problem on Linux (so with GLX):
    The visual I get from my FrameBuffer configuration ( glXChooseFBConfig / glXGetVisualFromFBConfig ) is not compatible with the one in the QGWidget.
    And so the glXCreateWindow needed for glXCreateContextAttribsARB, fails.

    I would like to know if it's possible to update or create the QGLWidget from my visual?

    Because it's seems important to match the glx concept :

    • FrameBufferConfiguration creation
    • Visual retrieving
    • XWindow creation from visual ( so my qt widget )
    • GLXWindow creation from FBConfig and XWindow
    • GLXContext creation from GLXWindow & FBConfig

  • I finally solver my problem by :

    • converting my XVisualInfo in a compatible QGLFormat
    • constructing my QGLWidget with this format
    • setDevice to my custom context with the qglwidget instance
    • setContext on the qglwidget with my custom context

Log in to reply