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. QOpenGL draw in to separate QOpenGLFramebufferObject - wrong buffer draw in ?

QOpenGL draw in to separate QOpenGLFramebufferObject - wrong buffer draw in ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qopenglwidgetqopenglframebuf
1 Posts 1 Posters 442 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 12 May 2019, 10:30 last edited by
    #1

    Hey

    I'm trying to do some selection processing for which I would like to draw my current context in to another buffer. However for some reason it still gets drawn in my main QOpenglWidget.

    Here is the code that runs in a function - not paint related function.

    makeCurrent();
            QOpenGLFramebufferObjectFormat fboFormat;
            fboFormat.setSamples(0);
            fboFormat.setAttachment(QOpenGLFramebufferObject::Depth);
            QOpenGLFramebufferObject fbo(size(), fboFormat);
            fbo.bind();
            QOpenGLPaintDevice deviceX(size()); // do I need it here if I just draw geometries and do no paiting?
            QPainter painterX; // do I need it here if I just draw geometries and do no paiting?
            painterX.begin(&deviceX); // do I need it here if I just draw geometries and do no paiting?
            //glEnable(GL_DEPTH_TEST);
            glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
            mScene->drawScene(viewProj, false);
            painterX.end();
            fbo.release();
            auto img = fbo.toImage();
            label->setPixmap(QPixmap::fromImage(imt));
            label->show(); /// used for debug
            QOpenGLFramebufferObject::bindDefault(); /// rebing back old proper widget FBO ?
            doneCurrent();
    
    

    When I run this set of commands, my main window changes but it should... not?

    Any help would be great.

    TIA

    1 Reply Last reply
    0

    1/1

    12 May 2019, 10:30

    • Login

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