Is OpenGL 1.1 still possible in Qt 5 ? (configured with -opengl desktop)



  • Hi,

    I recently installed Qt 5.0.1 with desktop opengl enabled instead of ANGLE.
    Now a want to compile my application which makes extensive use of gl 1.1.

    It appears that everything which was dropped by ES2.0 is not found in the headers (qgl.h and everything it loads).
    I cannot simply refer to GL/gl.h and use the platform specs since qgl.h has some conflicting defines. Ruling out qgl.h is also impossible since I use a QGLWidget.

    The documentation says nothing about dropped support for gl 1.1 so I expected this to work when not using ANGLE.
    Is this a bug or a feature?


  • Moderators

    Minimal version is OpenGL 2.0, afaik. 1.1 is not even prehistoric, it's more like the dawn of time itself.

    I'm not into OGL myself, though, I might be wrong. Try with newest sources from git, or with 5.1 alpha - maybe your problem was fixed in the meantime (OpenGL stuff is actively maintained now).



  • 5.0.2 has just been released, I will try that one first since there is stated it contains over 600 improvements.
    You are right about OpenGL 1.1, it exists for 20 years now and is completely outdated, still it is widely used because gl 1.1 runs on every Windows machine with or without a gpu because of the 1.1 gl software implementation Microsoft provided.
    I could only use gl 1.1 because the app had to run on this implementation on a Geode LX 800 etx board (no gpu).
    /update/
    The error remains the same ...
    I guess I'll just wait for some one with in depth knowledge to answer my question.



  • QtQuick2 requires OpenGL 2 as a minimum but using QGLWidget or QWindow+QOpenGLContext should still be possible to use OpenGL 1.1.

    What exact errors do you see?



  • I have for example this simple initializeGL function:

    @void GLScene::initializeGL()
    {
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glFrontFace(GL_CCW);
    
    glEnable(GL_LIGHTING);
    
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
    glEnable(GL_COLOR_MATERIAL);
    
    static const GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
    static const GLfloat light_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
    static const GLfloat light_specular[] = { 0.8, 0.8, 0.8, 1.0 };
    static const GLfloat light_position[] = { 0.0, 0.6, 0.4, 0.0 };
    
    glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    
    glEnable(GL_LIGHT0);
    

    }@

    10: error: 'GL_LIGHTING' was not declared in this scope
    12: error: 'GL_AMBIENT_AND_DIFFUSE' was not declared in this scope
    13: error: 'glColorMaterial' was not declared in this scope
    14: error: 'GL_COLOR_MATERIAL' was not declared in this scope
    20: error: 'GL_LIGHT0' was not declared in this scope
    20: error: 'GL_AMBIENT' was not declared in this scope
    20: error: 'glLightfv' was not declared in this scope
    21: error: 'GL_DIFFUSE' was not declared in this scope
    22: error: 'GL_SPECULAR' was not declared in this scope
    23: error: 'GL_POSITION' was not declared in this scope

    As you can see, only deprecated gl stuff cannot be found by mingw 4.7.2.
    So it appears that the headers (qgl.h and all its descendants) do contain the gl stuff excluding the deprecated functions (which are still in GL\gl.h in the include dir of mingw btw).
    This all compiles perfectly with Qt 4.8x and mingw 4.4.

    There are only 3 posibilities:

    • it's a serious bug (probably not).

    • pre gl 2.0 stuff has been dropped from Qt 5 since everywhere is stated it requires gl 2.0 to run qml 2. Once you have gl 2.0 there is no need to use the deprecated stuff anyway (logical only when creating new apps, not logical when qml 2 remains unused in your project).

    • they changed the behavior of qgl.h so you must do more effort to use the deprecated stuff by including another header (this I cannot find in the docs so if find it less likely than option 2).



  • An update.
    Meanwhile I've tried to compile the hellogl example located "here.":http://qt-project.org/doc/qt-5.0/qtopengl/hellogl.html
    QMake fails with the following message:
    warning: Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c
    error: This example requires Qt to be configured with -opengl desktop

    These messages are thrown by a test within the .pro file even though I compiled Qt with the following settings:
    C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\configure -opensource -prefix C:\Qt\Qt5.0.2\5.0.2\mingw47_32 -nomake examples -nomake demos -nomake tests -platform win32-g++ -c++11 -opengl desktop

    So
    @contains(QT_CONFIG, opengles.)@

    and
    @contains(QT_CONFIG, angle)@

    return true even though -desktop opengl is used, any thoughts on what is happening here?
    I've already re-run configure and rebuild Qt again to exclude the tiny possibility I forgot a step or build another version.



  • I just compiled Qt again on a virgin XP SP 3 system (machine had no other software).
    The hellogl demo also doesn't compile because of the warning that ANGLE is used even though Qt was compiled with -desktop opengl flag set with configure.exe.
    When removing the warning code from the pro file, all deprecated GL code is not found by the compiler.
    So it seems compiling configure.exe screws the settings and keeps using ANGLE.
    Does anyone sees what is wrong with the following configure arguments?

    C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\configure -opensource -prefix C:\Qt\Qt5.0.2\5.0.2\mingw47_32 -nomake examples -nomake demos -nomake tests -platform win32-g++ -c++11 -opengl desktop

    Ik looks like everything is ok, but why then is ANGLE still being used. :(



  • there is another option for angle:
    @ + -angle ............. Use the ANGLE implementation of OpenGL ES 2.0.
    -no-angle .......... Do not use ANGLE.
    See http://code.google.com/p/angleproject/@

    maybe adding "-no-angle" helps ...

    I haven't tried building Qt5 without Angle till now, but I'm a bit interested as the instability of Angle is on blocker to choose Qt5 in future projects



  • Thx for the advice.
    I recompiled Qt again but the same problem still exists.
    I now used C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\configure -opensource -prefix C:\Qt\Qt5.0.2\5.0.2\mingw47_32 -nomake examples -nomake demos -nomake tests -platform win32-g++ -c++11 -opengl desktop -no-angle


Log in to reply
 

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