Important: Please read the Qt Code of Conduct -

Multisampling: QSurfaceformat::samples() always returns -1

  • Hi all,

    I am using QOpenGLWidget to render 3D scene and I want to turn on MSAA even before my App is running.

    This is what I do now:

    SurfaceFormat format;
    format.setVersion(3, 3);
    int samples = format.setSamples(8)
    // int samples = format.samples()

    However, either samples() or setSamples(int) returns -1. I wonder if I need to turn on something from OpenGL side. Therefore I did this before setting up format:


    As you may guess, setSamples(8) still returns -1. I begin to doubt if my system doesn't support MSAA at all. But I don't know how to check it. Could you please help me out? Either checking if my system could support multisampling or the correct way to use multisampling. Thanks

    Note: Platform: Qt5.6 + Ubuntu16.04 + C++14

Log in to reply