Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL draws over widgets in Qt

Tags:

c++

qt

opengl-es

I'm developing a Qt app which uses Cocoa on the Mac and am using PowerVR SDK to enable OpenGL ES 2.0 on Mac Desktop.

I've managed to get it working, everything renders perfectly, the problem is that when I'm creating a widget in that window, OpenGL renders over it, e.g I'm creating a QLabel and it renders over it, making the label invisible.

I tried calling QLabel's repaint() method after rendering a single OpenGL frame, but that didn't help.

Has anyone encountered such or similar issue and has any suggestions?

Thanks!

like image 764
Max Raskin Avatar asked Nov 10 '22 05:11

Max Raskin


1 Answers

If you wish widgets to interoperate with OpenGL content, you must use the QOpenGLWidget. It draws to an offscreen buffer that then gets composited with the widgets.

Alternatively, you must yourself render the label into a texture, and apply the texture to a quad.

like image 92
Kuba hasn't forgotten Monica Avatar answered Nov 15 '22 11:11

Kuba hasn't forgotten Monica