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. QGraphicsView and QGLFramebufferObject: render with alpha channel
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView and QGLFramebufferObject: render with alpha channel

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.7k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Peter K
    wrote on last edited by
    #1

    I am rendering a 3D world and want to render the contents of a QGraphicsView on top of it. The render process is done in a specialized render thread. The rendering of a QWidget can not be done in this thread, as it has to be done in the GUI thread. For this reason I want to render a QWidget onto the texture of a QGLFramebufferObject. This texture will be used later as an overlay, on top of the 3D rendering, using native OpenGL calls.

    Assume the threadsafety has been managed.

    The problem is that the alpha channel of the texture is not used. This means that any transparent components of the widget cannot blended correctly. From what I've seen, the alpha channel is set to 1, as OpenGL blending renders the overlay opaque.

    I render the widget using the following (sample) code:

    @
    // Somewhere in an init function
    QGLFramebufferObject* fbo;
    fbo = new QGLFramebufferObject(800, 600, QGLFramebufferObject::CombinedDepthStencil);

    ...

    // The paintEvent funtion of the QGraphicsView
    // (GUI thread)
    QPainter p(fbo);
    this->render(&p);
    p.end();
    return;

    ...

    // Final render function
    // (Render thread)
    draw3DWorld();
    drawOverlay(fbo->texture());
    @

    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