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. QOpenGLWidget: QSurfaceFormat sample count doesn't match *actual* sample count
Forum Updated to NodeBB v4.3 + New Features

QOpenGLWidget: QSurfaceFormat sample count doesn't match *actual* sample count

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 199 Views
  • 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.
  • C Offline
    C Offline
    C. Hafner
    wrote on last edited by
    #1

    I'm using an QOpenGLWidget to render some stuff in OpenGL 4.5 Core. Before displaying the window, I set the QSurfaceFormat. Depending on the number of samples (let's say 0 and 8), I get the desired behavior.

    For 0 samples: samples_0.PNG
    For 8 samples: samples_8.PNG

    Other integers also work as expected. But the strange thing is, that querying the current format in initializeGL() or paintGL() always yields the default surface format.

    void MyWidget::paintGL()
    {
        auto fa = format();
        std::cout << "Samples: " << fa.samples() << std::endl;
        [...]
    }
    

    always prints "Samples: 0", no matter what number of samples is actually displayed in the widget.
    However,

    GLint n;
    gl_func->glGetFramebufferParameteriv(GL_FRAMEBUFFER, GL_SAMPLES, &n);
    std::cout << "Samples: " << n << std::endl;
    

    gives the correct number of samples.

    I've also tried changing the default QSurfaceFormat before initializing anything, but the behavior is the same.
    This behavior is not a problem for me per se, but I'd be interested in knowing what causes it and whether it can be avoided.

    OS: Windows 10 64-bit
    GPU: GTX 1080 Ti
    Using cmake + Visual Studio 2017 x64

    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