Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Sharing OpenGL context with glfw or SDL



  • I am building an application which can be used to create interactive graphics in OpenGL. For live shows it is crucial that the output is always being updated, even if the UI hangs in some slow operations. This means I need to show the output on a non Qt window (SDL or glfw or something else), because Qt only supports one GUI thread. Is it possible to share OpenGL contexts between Qt and any other OpenGL windowing/ context creation library, running in a separate thread? Does anybody know what my possibilities are here?

    Thanks for your help!


  • Lifetime Qt Champion

    @aart Why not move the slow operations out of the GUI thread to another thread?



  • @jsulm The graphics should be rendered uninteruptably at 60 fps in a separate thread so that the GUI stuff cannot interfere with that. The displaying of this should also happen uninterupted which means it cannot happen on Qt's GUI thread because there could be hiccups here. Since Qt doesnt support two GUI threads I need to get creative. Thats why i wanted to use another windowing library that can run seperately from the Qt event loop and then share OpenGL contexts. Not sure if any of this is possible though :(



  • What "GUI stuff" is going to interfere? Either the app is designed to operate at 60 fps or it is not. What else is the gui going to have besides the output window? If stuff is event driven with heavy processing of data sent to threads then nothing will cause it hang in slow ops. Are you generating content in the background?


Log in to reply