Is it possible to view background color or other widgets behind QGLWidget by using transparent GL background (glClearColor)?
-
I have a
QGLWidget
where I want to set transparent background in GL, and in order to get proper blending I end up premultiplying the alpha of background color (for details of what/why on "premultiplying" here is an example blog post I found). This means in the case of a completely transparent background, theglClearColor
becomes completely black(with 0 alpha): RGBA = 0,0,0,0I want to have a solid background color visible for user convenience, but in a different color than the black that I get from pre-multiplying. The reason for wanting separate "displayed" background vs whats in GL frame buffer is because I need to be able to
grabFrameBuffer
and export images which can have transparent backgrounds.I have tried setting the
QGLWidget
's background color via itsQPalette
, and even the palette of itsparentWidget
, and tried dozens of combinations of different widget attributes etc, but I basically only have seen one of 2 results:- The black background of
QGLWidget
shows completely opaque, can't see the palette bg color.
OR - The
QGLWidget
is completely transparent and views the desktop or other windows behind my application, but still no palette bg color.
So is it possible to see through a
QGLWidget
onto a Qt-defined (not GL) background color? Or to view some other opaque widget behind theQGLWidget
? - The black background of