[Solved] How to enable the accumulation buffer at QGLWidget?



  • Hello,

    I'm trying to use the accumulation buffer in QGLWidget class, and wrote the following code:

    @
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    QGLFormat format = QGLFormat::defaultFormat();
    format.setAccum(true);
    format.setAccumBufferSize(24);
    QGLFormat::setDefaultFormat(format);
    QGLWidget* testWidget = new QGLWidget(this);
    ui->mainLayout->addWidget(testWidget);
    
    assert(testWidget->format().accum());
    

    }
    @

    The problem is, this code always fails at the assertion test. This means the instantiated QGLWidget does not enable the accumulation buffer feature.

    Am I doing something wrong? Any suggestions? Hope someone will help me.

    Qt Creator 3.0.1
    Qt 5.2.1 (Clang 5.0 (Apple), 64 bit)
    MacBook Air (OS X 10.8.5)

    Thank you



  • Your code looks fine. Maybe your graphic driver dont support accumulation buffer - it is legacy feature. Some drivers support it for backward compatibility, some not. Your can check supported OpenGL versions, formats and extensions with utilities like "GLView":http://www.realtech-vr.com/glview/



  • Thank you mtrch, I didn't know that the accumulation buffer has been deprecated. That's why my code doesn't work.


Log in to reply
 

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