Results 1 to 3 of 3

Thread: OpenGL 4.4 Context

  1. #1
    Join Date
    Jan 2008
    Posts
    20
    Thanks
    1

    Default OpenGL 4.4 Context

    Hi,

    I'm trying to integrate my opengl renderer with a qml (windows desktop) application.
    My current setup is VS 2013 (with qt plugin) and Qt 5.6. Qt was installed using the maintenance tool. Before there was an option to choose between qt_opengl and qt_angle, for 5.6 i don't see that option anymore (maybe important info, i don't know). I have a AMD firepro M4100 FireGL which supports OpenGL up to 4.4 (according to OpenGL extension viewer)
    As a guide to integrate my renderer, i used the Squircle example. Everything works ok (The area i want in my qml app uses the renderer to render it's content), i only fail to get the correct context (version) for my renderer. The renderer expects OpenGL 4.x, but i only seem to be able to get an OpenGL ES (3.0) context.
    The things I tried (but failed):

    At the start of my app, i did:
    Qt Code:
    1. QSurfaceFormat format;
    2. format.setVersion(4, 4);
    3. format.setProfile(QSurfaceFormat::CoreProfile);
    4. format.setRenderableType(QSurfaceFormat::OpenGL);
    5. ...
    6. QSurfaceFormat::setDefaultFormat(format);
    To copy to clipboard, switch view to plain text mode 
    My "MainWindow" is a QML Window element and I use a QQmlApplicationEngine to load the main file. After _engine->load(...) i did:
    Qt Code:
    1. QQuickWindow* w = (QQuickWindow*)_engine->rootObjects().first();
    2. if(w)
    3. {
    4. format.setVersion(4, 4);
    5. format.setProfile(QSurfaceFormat::CoreProfile);
    6. format.setRenderableType(QSurfaceFormat::OpenGL);
    7. ...
    8. w->setFormat(format);
    9.  
    10. w->showMaximized();
    11. }
    To copy to clipboard, switch view to plain text mode 
    I get in debug an error that this version of the openglcontext cannot be created and i should install drivers which can create it, or put some dlls (d3dcompiler, libglesv and libegl) next to my application ((this last one doesn't make a difference).

    I also tried to get the OpenGL ES 3.3 context (by changing the numbers in the above function) Then when i use the window() method from the qquickitem that i positioned in my app, to get the opengl context, and when i ask in my renderer
    Qt Code:
    1. int minor = m_window->openglContext()->format().minorVersion();
    2. int major = m_window->openglContext()->format().majorVersion();
    3. bool es = m_window->openglContext()->isOpenGLES();
    To copy to clipboard, switch view to plain text mode 
    i get OpenGLES 3.0. I'm clueless on how to tell the qml app to use OpenGL 4.4. Anybody has an idea?
    Regards,

    Jan
    Last edited by anda_skoa; 22nd June 2016 at 13:54. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2008
    Posts
    20
    Thanks
    1

    Default Re: OpenGL 4.4 Context

    When I downgrade to Qt 5.5, it works like expected (5.6 and 5.7 don't). Probably something to do with the default installation of Qt (using angle)?

    Jan


    Added after 50 minutes:


    As found here: http://doc.qt.io/qt-5/windows-requirements.html, if i set QT_OPENGL env, variable to desktop, it works!

    Jan
    Last edited by JanW; 22nd June 2016 at 11:25.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL 4.4 Context

    Just for additional information:

    Qt 5.6 and higher try to detect at runtime whether to use ANGLE or native OpenGL, so that applications can better adapt to what the user is actually running (if native OpenGL is available or whether ANGLE is needed).

    However, it should still be possible to build Qt with specifically either option being enabled.

    Cheers,
    _

Similar Threads

  1. QT4 mess up the OpenGL context ?
    By fev in forum Qt Programming
    Replies: 0
    Last Post: 19th October 2009, 10:25
  2. context of opengl is changing on mac os x
    By Sandip in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2008, 12:25
  3. help on openGL context
    By mickey in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2006, 19:21
  4. Qt's optimized OpenGL context switching
    By sverhoff in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 16:40
  5. Context OpenGL
    By mickey in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2006, 21:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.