The OpenGL pbuffer example appearing blank



  • I am using Qt 5 cloned from git and build using command,
    "configure -developer-build -opensource -nomake tests -nomake examples -opengl desktop -mp"
    When I tried running opengl examples which come with Qt source e.g. pbuffer , its getting blank screen.
    Then i tried checking the openGL version, i have openGL version 3.3.

    I added logs and tried setting version to QGLFormat in glwidget.cpp
    @GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
    , geom(0)
    , cube(0)
    {
    // create the pbuffer
    QGLFormat pbufferFormat = format();
    pbufferFormat.setVersion(3,3); // added by me
    QGLFormat::setDefaultFormat(pbufferFormat); // added by me

    pbufferFormat.setSampleBuffers(false);
    pbuffer = new QGLPixelBuffer(QSize(512, 512), pbufferFormat, this);
    setWindowTitle(tr("OpenGL pbuffers"));
    initializeGeometry();
    

    }

    void GLWidget::paintGL()
    {
    pbuffer->makeCurrent();
    drawPbuffer();

    // added by me
    QString openGLversion((char *)glGetString(GL_VERSION));
    qDebug()<<"OpenGL version::" << openGLversion;
    qDebug()<<"\nOpenGL format verions:: " << QGLFormat::openGLVersionFlags();
    qDebug()<<"\nOpenGL context::" << this->format();
    ...
    }
    @log output:

    OpenGL version:: "3.3.0"

    OpenGL format verions:: QFlags(0x1|0x2|0x4|0x8|0x10|0x20|0x40|0x1000|0x2000|0x4000|0x8000)

    OpenGL context:: QGLFormat(options QFlags(0x1|0x2|0x4|0x8|0x20|0x80|0x200|0x400) , plane 0 , depthBufferSize 24 , accumBufferSize -1 , stencilBufferSize 8 , redBufferSize 8 , greenBufferSize 8 , blueBufferSize 8 , alphaBufferSize 8 , samples 4 , swapInterval -1 , majorVersion 3 , minorVersion 3 , profile 0 )

    With this change of setting version I still observed blank screen , however if I make any version set below 3.2 I can see the proper output on screen :)
    @ pbufferFormat.setVersion(3,1); // i tried with 1.0 / 2.1/ 3.0@
    but in the logs still it gives output as "OpenGL version:: "3.3.0" "

    can anyone please explain what is the issue here and why defaults qt examples from qt git src are behaving like this.


Log in to reply
 

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