Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QOpenGLWidget bug?
Qt 6.11 is out! See what's new in the release blog

[SOLVED] QOpenGLWidget bug?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    opensw
    wrote on last edited by
    #1

    Hello there, I have a strange behaviour in my application when I am trying to switch from default OpenGL core profile to 4.3.

    In the main I have:
    @int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QSurfaceFormat format;
    format.setDepthBufferSize(24);
    format.setProfile(QSurfaceFormat::CoreProfile);
    format.setVersion(4, 3);
    QSurfaceFormat::setDefaultFormat(format);

    Start w;
    w.show();
    return a.exec();
    }@

    I have a custom widget that I am using in the GUI (3D rendering):
    @class MyOpenGL : public QOpenGLWidget
    {
    public:
    MyOpenGL(QWidget* widget);
    virtual ~MyOpenGL();

    protected:
    void initializeGL() override;
    void paintGL() override;
    void resizeGL(int w, int h) override;
    };@

    In the constructor the core profile is 4.3 like expected (via format() property), but in initializeGL(), paintGL() and resizeGL(int w, int h) is always 3.1. I do not have any ideas what is wrong.

    I am on Qt 5.4 Windows 8.1 x64 OpenGL version and NVIDIA 550m

    Cheers
    Paolo

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      In the constructor the OpenGL context is not yet created so it will be a bogus value of whatever you set as default. The actual context is available in the initializeGL, paintGL and resizeGL functions.

      For some reason the requested version can't be obtained so you get the max possible, but 550M is a 4.4 HW so that shouldn't happen. I assume you have up to date drivers installed?

      Is your CPU by any chance an Intel with built-in graphics? Maybe the context is created using the wrong graphics chip? Can you check the output of glGetString(GL_RENDERER) and glGetString(GL_VENDOR) ?

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opensw
        wrote on last edited by
        #3

        Good morning Chris,

        '
        I assume you have up to date drivers installed?
        '
        Yes

        '
        Is your CPU by any chance an Intel with built-in graphics? Maybe the context is created using the wrong graphics chip? Can you check the output of glGetString(GL_RENDERER) and glGetString(GL_VENDOR) ?
        '
        Good point, I have an Intel i7-2670QM with Intel HD 3000 and the outputs are:

        • Intel(R) HD Graphics 3000;
        • Intel.

        Thanks a lot for the point :) I forgot that I have in the laptop the old Intel HD 3000 xD

        Cheers
        Paolo

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved