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. Window all blacked in OpenGL 3.1
Forum Updated to NodeBB v4.3 + New Features

Window all blacked in OpenGL 3.1

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 762 Views 2 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.
  • M Offline
    M Offline
    Mario1159
    wrote on last edited by Mario1159
    #1

    I'm using QOpenGLWidget and when i set QSurfaceFormat to version 3.1 the screen goes all black, not even clearing the color that it supposed to be.
    I have an Intel HD Graphics 3000 which supports up to OpenGL 3.1 (https://www.intel.la/content/www/xl/es/support/articles/000005524/graphics-drivers.html) and my drivers are up to date.
    This code is in my main.cpp

        QApplication a(argc, argv);
    
        a.setAttribute(Qt::AA_UseDesktopOpenGL);
    
        QSurfaceFormat fmt;
    
        fmt.setRenderableType(QSurfaceFormat::OpenGL);
        fmt.setProfile(QSurfaceFormat::NoProfile);
        fmt.setVersion(3, 1);
        QSurfaceFormat::setDefaultFormat(fmt);
    
        MainWindow w;
        w.show();
    

    i have set the UseDesktopOpenGL attribute to force the program to use desktop opengl because normally the opengl version it is set to Opengl ES even if my rendering type is set to OpenGL i dont know why.

    In previous version of OpenGL the windows work fine and also i tested changing the QSurfaceFormat

    raven-worxR 1 Reply Last reply
    0
    • M Mario1159

      I'm using QOpenGLWidget and when i set QSurfaceFormat to version 3.1 the screen goes all black, not even clearing the color that it supposed to be.
      I have an Intel HD Graphics 3000 which supports up to OpenGL 3.1 (https://www.intel.la/content/www/xl/es/support/articles/000005524/graphics-drivers.html) and my drivers are up to date.
      This code is in my main.cpp

          QApplication a(argc, argv);
      
          a.setAttribute(Qt::AA_UseDesktopOpenGL);
      
          QSurfaceFormat fmt;
      
          fmt.setRenderableType(QSurfaceFormat::OpenGL);
          fmt.setProfile(QSurfaceFormat::NoProfile);
          fmt.setVersion(3, 1);
          QSurfaceFormat::setDefaultFormat(fmt);
      
          MainWindow w;
          w.show();
      

      i have set the UseDesktopOpenGL attribute to force the program to use desktop opengl because normally the opengl version it is set to Opengl ES even if my rendering type is set to OpenGL i dont know why.

      In previous version of OpenGL the windows work fine and also i tested changing the QSurfaceFormat

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Mario1159 said in Window all blacked in OpenGL 3.1:

      QSurfaceFormat fmt;

      fmt.setRenderableType(QSurfaceFormat::OpenGL);
      fmt.setProfile(QSurfaceFormat::NoProfile);
      fmt.setVersion(3, 1);
      QSurfaceFormat::setDefaultFormat(fmt);
      

      why do you need to force those?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mario1159
        wrote on last edited by Mario1159
        #3

        @raven-worx because if i comment a.setAttribute(Qt::AA_UseDesktopOpenGL); and put this qDebug() << reinterpret_cast<const char*>(glGetString(GL_VERSION)); in initializeGL in my QOpenGLWidget , i get OpenGL ES 3.0 (ANGLE 2.1.0.unknown hash) instead of desktop opengl 3.1

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          What are you running? What kind of machine?
          I have desktops and have tried to enable ES on them and it failed. I figured this is because I am not running an ES capable device. Is it possible your device only supports ES and not desktop GL?

          C++ is a perfectly valid school of magic.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mario1159
            wrote on last edited by
            #5

            @fcarney a notebook but as i said runs fine in older versions of desktop opengl, i have problems just in 3.1

            1 Reply Last reply
            0
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by
              #6

              That is weird.

              C++ is a perfectly valid school of magic.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mario1159
                wrote on last edited by
                #7

                So this problem is related with my system? can someone run a QOpenGLWidget with my format in their pc?

                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