Alternative way to get QOpenGLFramebufferObject anti-aliased texture other than multisampling + blitting

  • I'm trying to achieve anti-aliased effect on the texture of the FBO (QOpenGLFramebufferObject) used when doing native GL drawing on a Qt 5.2.1 widget-based application on WinCE-based device. It supports OpenGL ES 2.0 and apparently also GL_EXT_multisampled_render_to_texture extension.

    The mechanism described on Qt documentation using two QOpenGLFramebufferObject, one with multi-sample enabled (e.g. 4 samples) and another one without multi-sampling used as the target FBO to down-sample, then blitting from the multi-sampled one to the down-sampled one does not work.

    This is because the blit operation is not supported on the device, QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() returns false, even though it works properly anti-aliased on Win32 desktop where the blit is supported.

    Is there any other way to achieve the anti-aliasing without using this blit operation? Preferably using Qt components to ease the implementation.

    ----Details on the situation----
    The application displays the GL drawings as the screen background and on top of that the control widgets (buttons, labels, etc.). The GL drawings itself are done by a third party library that we use.

    For this we use QGraphicsView and QGraphicsScene to have the library draws the background and add the control widgets to the scene to be drawn on top of it.

    Aside from the QGLWidget's context created for the QGraphicsView's viewport, we have a separate GL context and FBOs created exclusively for the library to use because the library expects an exclusive context for itself. The contexts share display list and texture object and are switched before and after the library draws.

    The library draws depending on a QTimer callback to simulate the desired frames per second. During the drawing the multi-sampled FBO will be bound and released after the drawing is done, and then blitted to the down-sampled one.

    During the QGraphicsScene::drawBackground() the texture of the down-sampled FBO will be drawn on the viewport's context using QGLContext::drawTexture(). Sadly this draws garbage on the device because the blit operation from the multi to down-sampled FBO is not supported.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.