[Interest] Unable to get QGLFramebufferObject working with OpenGL ES 2

Preet prismatic.project at gmail.com
Fri Jun 15 06:46:36 CEST 2012


Hi,

I'm trying to draw the contents of a QGLFramebufferObject onto a
QDeclarativeItem. To do this, I first draw onto the FBO and then call
QGLFramebufferObject::drawTexture(...) in the item's paint() method.
This seems to work as expected on the desktop, but doesn't work on a
device that uses OpenGL ES 2. When I call the drawTexture method, I
get the following output:
"drawTexture() with OpenGL ES 2 requires an active OpenGL2 paint
engine". When I explicitly check, I see that the paint engine type is
OpenGL2 and that it's active... but it still fails. Here's how I
create, draw to and paint the fbo:

    // create the frambuffer object
    m_frameBufferObj =
            new QGLFramebufferObject(width(),height(),
                QGLFramebufferObject::NoAttachment,               // I
tried playing around with Attachment types to no avail
                                     GL_TEXTURE_2D,
                                     GL_RGBA);


        // draw viewport contents to fbo
        QPainter fboPainter(m_frameBufferObj);
        fboPainter.beginNativePainting();
        m_frameBufferObj->bind();
        this->drawViewport();
        m_frameBufferObj->release();
        fboPainter.endNativePainting();
        fboPainter.end();

        // draw fbo contents to item
        if(qPainter->paintEngine()->type() == QPaintEngine::OpenGL2 &&
                qPainter->paintEngine()->isActive())
        {
            m_frameBufferObj->drawTexture(localBounds,      // this is
the call that fails
                m_frameBufferObj->texture());
        }

My overloaded paint() method, initialization and what I draw to the
fbo (just a triangle) is here: http://pastie.org/4090279. I'd
appreciate any advice on how I could get this working.


Preet



More information about the Interest mailing list