Important: Please read the Qt Code of Conduct -

Sample Buffers

  • What are sample buffers?

    I am learning the basics of OpenGL with Qt and it seems sample buffers are Qt specific, and I don't really understand what information they store for the screen.

  • Moderators

    This is not Qt specific topic.

    This is called multisampling. It is a technique of anti-aliasing (getting rid of sharp, blocky edges).

    This is an example how it looks ilke:

    To achieve this a special type of format is needed for front and back buffers (the ones you draw into).
    In vanilla OpenGL this is a platform specific feature. On windows you need to pass special attributes when creating OpenGL window (specifically WGL_SAMPLE_BUFFERS and WGL_SAMPLES).

    Qt handles it by calling setSampleBuffers(true) and setSamples(sampleCount) on QGLFormat before creating a GL widget.

    As for the quality - the more samples, the smoother the edges are. For now 2, 4 and in some cases 8 samples are supported I think, depending on your graphics hardware.

Log in to reply