Having two widgets in one window with QT 5.13, one widget should render preview, while the other one should render with another camera. We used EGL. Should I create one OpenGL context attached to each QWidget/HWND used in main thread and render to two HWND, or two sub thread each take charge of each context? We need the OpenGL resource(shader/texture) shared.
Asked
Active
Viewed 302 times
1
-
Did you solve the problem? – Jerikc XIONG May 13 '20 at 15:12
-
@JerikcXIONG Yeah. Need to create a thread per widget. Just get two HWND in two separate widget, and create two separate OpenGL context using EGL in two thread. All EGL & OpenGL related operation must be in the widget's thread. – heLomaN May 14 '20 at 11:23
-
Cool. Do you have any sample code ? @heLomaN – Jerikc XIONG May 14 '20 at 16:42
-
1@JerikcXIONG Here is a blog about using EGL with HWND. https://www.saschawillems.de/blog/2015/04/19/using-opengl-es-on-windows-desktops-via-egl/ Sorry for no demo code to be public, but just create a std::thread and do sth in it. – heLomaN May 14 '20 at 17:01
1 Answers
0
Here's link there is a discussion on EGL and the opengl context. I have not experience about egl programming but in qt desktop application it's possible share the same context on two different view and on one view use a different camera.

user1746397
- 48
- 1
- 7