Pergunta

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. What is a Sample Buffer and what is it used for?

Foi útil?

Solução

They are used to get multisampling in Qt. Setting up multisampling is normally platform specific (since it requires a pixel format with multisampling support), but Qt lets you do this in a platform independent way. To get a OpenGL context with multisampling you pass a QGLFormat with sample buffers enabled when creating your QGLWidget.

Specifically, QGLFormat::setSampleBuffers is used to request a multisampled context and QGLFormat::setSamples is used to set the prefered number of samples.

In your OpenGL code you also have to enable multisampling before rendering:

glEnable(GL_MULTISAMPLE);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top