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. [SOLVED] clearing FrameBuffer
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] clearing FrameBuffer

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

    Hello

    i draw on a FBO with QPainter in an animation loop. The problem is i need to clear the FBO in every frame but this doesn't work. The only way to get it work is to use a background color like white, black or whatever but not with transparent.

    @
    // slot for QVariantAnimation signal valueChanged
    void updateValue(const QVariant &value) {
    //QGLFramebufferObject
    this->_fbo->bind();
    QPainter painter(this->_fbo);
    painter.setBackground(Qt::transparent);
    painter.eraseRect(this->boundingRect());
    painter.fillRect(0 + value.toInt(), 0, 100, 100, Qt::green);
    this->_fbo->release();
    this->update();
    }
    @
    The problem the FBO is not clear and so i get a large green rectangle instead of a nice moving one :) Any suggestions?

    **Sorry for my english :)

    PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasRicardo
      wrote on last edited by
      #2

      OK, i solved the problem. The magical part is this:

      @
      this->_fbo->bind();
      glClear(GL_COLOR_BUFFER_BIT);
      this->_fbo->release();
      @

      **Sorry for my english :)

      PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

      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