Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to view background color or other widgets behind QGLWidget by using transparent GL background (glClearColor)?

Is it possible to view background color or other widgets behind QGLWidget by using transparent GL background (glClearColor)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qglwidgettransparencyalphabackground
1 Posts 1 Posters 530 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thehans
    wrote on last edited by
    #1

    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, the glClearColor becomes completely black(with 0 alpha): RGBA = 0,0,0,0

    I 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 its QPalette, and even the palette of its parentWidget, and tried dozens of combinations of different widget attributes etc, but I basically only have seen one of 2 results:

    1. The black background of QGLWidget shows completely opaque, can't see the palette bg color.
      OR
    2. 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 the QGLWidget?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved