c++qtopenglantialiasingmsaa

glReadPixels() doesn't return an Anti-aliased picture


When I render my scene to the screen, the scene uses a _MultiSampling Anti-Aliasing 8x; it's ok.

But I want to read to the pixel buffers through glReadPixels(), I have a Aliased-Image with Aliased lines. It doesn't use the 8x MSAA.

Code:

glReadPixels(0,0, w, h, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (void*)pixels);

How do I access to the pixels buffer with the MSAA transformation (filter)?

glReadPixels doesn't have a special parameter.

Side Note: I would like to use the Opengl 1

Important Note: I use Qt 5.9's QOpenGLWidget class


Solution

  • I take it that you're rendering to an off-screen renderbuffer or texture via FBO. The solution is to create a renderbuffer that uses a MSAA pixelformat. Antialiasing is not a postprocessing filter! (at least not in the form MSAA implements it).