Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Flickering FBO When Resizing Vertically
Qt 6.11 is out! See what's new in the release blog

Flickering FBO When Resizing Vertically

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.2k 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.
  • S Offline
    S Offline
    SEmami
    wrote on last edited by
    #1

    I get a flickering when QQuickFramebufferObject is vertically resized. Oddly enough, there is no flickering when resizing horontally. Here is the code:

    file main.qml:
    @import QtQuick 2.3
    import QtQuick.Controls 1.1
    import QtQuick.Layouts 1.1
    import Tools 1.0

    ApplicationWindow {
    width: 1000; height: 400
    visible: true
    toolBar: ToolBar {
    RowLayout {
    anchors.fill: parent
    ToolButton { id: button1; text: "button1"; anchors.left: parent.left }
    ToolButton { id: button2; text: "button2"; anchors.left: button1.right }
    }
    }
    RowLayout {
    anchors.fill: parent
    ColumnLayout {
    id: col1
    anchors.left: parent.left; Layout.fillHeight: true
    Button { id: button3; text: "button3"; width: 100 }
    Button { id: button4; text: "button4"; width: 100; anchors.top: button3.bottom }
    }
    Rectangle {
    anchors.left: col1.right; anchors.right: parent.right; Layout.fillHeight: true
    Renderer { anchors.fill: parent }
    }
    }
    }@

    file main.cpp:
    @#include <QApplication>
    #include <QQmlApplicationEngine>
    #include "fbo.h" // FBO

    int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    QQmlApplicationEngine engine;
    qmlRegisterType<FBO>("Tools", 1, 0, "Renderer");
    engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
    app.exec();
    return 0;
    }@

    file fbo.h:
    @#ifndef FBO_H
    #define FBO_H
    #include <QQuickFramebufferObject>
    #include "fborenderer.h" // FboRenderer

    class FBO : public QQuickFramebufferObject {
    Q_OBJECT
    public:
    Renderer* createRenderer() const { return new FboRenderer(); }
    };
    #endif // FBO_H@

    file fborenderer.h:
    @#ifndef FBORENDERER_H
    #define FBORENDERER_H
    #include <QQuickFramebufferObject> // QQuickFramebufferObject
    #include <QOpenGLFramebufferObject> // QOpenGLFramebufferObject

    class FboRenderer : public QQuickFramebufferObject::Renderer {
    public:
    void render();
    QOpenGLFramebufferObject* createFramebufferObject(const QSize &size);
    };
    #endif // FBORENDERER_H@

    file fborenderer.cpp:
    @#include "fborenderer.h"
    #include "fbo.h" // FBO

    void FboRenderer::render() {
    glClearColor(0.6, 0.1, 0.2, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }
    QOpenGLFramebufferObject* FboRenderer::createFramebufferObject(const QSize& size) {
    QOpenGLFramebufferObjectFormat format;
    format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
    format.setSamples(16);
    return new QOpenGLFramebufferObject(size, format);
    }@

    As mentioned earlier, the minor flickering is there only when the scenegraph is resized vertically. I am running qt5.3.2(gcc 4.6.1, 64bit) on Linux Centos 6.5.

    As far as I can tell, changing the qml rendering does not fix this. I tried digging in the source files and I couldn't find any difference between how height change is handled versus how width change is.

    I also get same flickering for Scene Graph FBO examples (http://doc.qt.io/qt-5/qtquick-scenegraph-textureinthread-example.html and http://doc.qt.io/qt-5/qtquick-scenegraph-textureinsgnode-example.html .) I didn't notice any difference between resizing vertically and horizentally when using classic opengl with glwidget. It seems slower and flickering when resizing in both directions.

    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