Please nominate your Qt Champions for 2021!

QGLWidget always has QGLContext with OpenGL version 1.0 in Qt 4.8.6

  • I am trying to use a QGLWidget from Qt 4.8.6 to render OpenGL geometry under OS X 10.9.4. However the version number reported by context().format() remains fixed at OpenGL version 1.0.

    "I found this older thread": discussing the problem that one can not reach a OpenGL version number higher than 2.1. Unfortunately this seems to be a different and unrelated issue, since i can not even get the context up to version 2.1.

    For testing purposes i use the Core Profile example available from the svn at "the qt-project wiki.":

    Has anybody encountered this problem before?
    Any hint and pointers are very welcome.

  • It would be great if someone else could verify this behaviour on other machines, to figure out wether or not it is specific to my machine.

    The following code is a minimal example not working for me under OS X (but working under Ubuntu Linux)
    #include <QtOpenGL/QGLFormat>
    #include <QtOpenGL/QGLWidget>
    #include <QtGui/QApplication>
    #include <QtCore/QDebug>

    int main(int argc, char **argv) {
    QApplication app(argc, argv);

    QGLFormat fmt = QGLFormat::defaultFormat();
    QGLWidget c(fmt);;
    qDebug() << c.context()->requestedFormat();
    qDebug() << c.context()->format();
    return app.exec();


    when compiled with

    g++ main.cpp -framework OpenGL -framework QtGui -framework QtCore -framework QtOpenGL -o test

    It prints two lines with QGLFormat dumps. The first is the requested and the second the actually active context format. If everything works as expected they should match. For me the second always looks like this:

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

    Any help is very much appreciated.

Log in to reply