0

I'm doing heavy texture streaming (multiple live video streams) with OpenGL using pixel puffer objects (using QtOpenGL/QGLWidget is not an option here) in Linux.

The texture streaming is done by a separate, custom OpenGL cpp module and thread (separate from Qt libraries completely)

However, I want to stream into x windowses that are operated by the Qt subsystem (i.e. the videos appear in the widgets)

I have two options:

  1. Create a qt widget, get the x window id of the widget and pass that to my custom OpenGL module

    Qt => window_id => custom OpenGL module

    In the custom OpenGL module I then use that window_id with glxMakeCurrent as a rendering target.

  2. Create an x window in my custom OpenGL module. Pass the id of the x window to the Qt module, i.e.:

    custom OpenGL module => window_id => Qt

    This is "healthier", because I can create a custom x window having the correct parameters corresponding to glx framebuffer configurations, i.e.: glx framebuffer config => visual => colormap => parameters for creating the X window

    A "foreign" window can then be used in Qt like this (in PyQt):

    q_window =QtGui.QWindow.fromWinId(win_id)
    q_widget =QtWidgets.QWidget.createWindowContainer(q_window,parent=parent)
    

Both options work in principle, but ..

In (1), after several hours, the x-window system starts to choke up .. windowses are unresponsive, etc. Very weird. I am suspecting some sort of overflow of signals in the x-window system (and therefore, in the qt event loop) .. ?

Option (2) does not suffer from this problem, but of course, I'll loose all window interaction..! i.e., there is no way to get mouse click events, drag'n'drop etc. from the custom "q_widget" (see above)

So, the questions are:

  • In option (1), there seems to be something unhealthy.. I'm not sure what it is as it goes quite deep into the X window system. Any insight on this?
  • How can I get mouse click, etc. events from a "foreign" window into the Qt subsystem?
genpfault
  • 51,148
  • 11
  • 85
  • 139
El Sampsa
  • 1,673
  • 3
  • 17
  • 33
  • Have you checked for memory leaks in option 1? It's a bit hard to debug, or even suggest debugging strategies, without being able to run an example application ourselves... – three_pineapples Feb 19 '18 at 22:22
  • 1
    What about the third option: shared OpenGL contexts? The Qt part can have its own window and render thread, it'll get texture IDs from the other renderer. – Velkan Feb 20 '18 at 09:56

0 Answers0