0

As the title suggests, I'm using Qt for OpenGL drawing, and with QOpenGLWidget I can turn on multisampling for the main screen buffer with QSurfaceFormat's setSamples() function. This works fine and looks pretty nice. However, I'm also drawing into a custom frame buffer (using glGenFramebuffers, glBindFramebuffer(), etc) in the background, where I don't want anti-aliasing (since it's drawing using color encoding for selection purposes), but it seems to be inheriting the multi-sampling from the main QOpenGLWidget somehow. Any ideas on how to disable that, to use multisampling in the main window but not in my own custom off-screen frame buffers?

2 Answers 2

1

Multisampled rendering is enabled or disabled by using the glEnable/Disable(GL_MULTISAMPLE). This state is not part of the framebuffer's state; it's regular context state. As such, even when you switch framebuffers, that state will be unaffected.

Additionally, the multisample enable/disable switch doesn't mean anything if your attached images don't have multiple samples. If you're creating images for non-multisampled rendering, there's no reason to create them with multiple samples. So create single-sample images.

Sign up to request clarification or add additional context in comments.

Comments

0

Well, couldn't find a way to disable it or avoid it in my OpenGL code, but if I set the default format to have 0 samples and the format of the QOpenGLWidget to have 2/4/8/whatever, then the framebuffer object won't use anti-aliasing when it's created.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.