Qt World Summit: Register Today!

QML Canvas3D multisampling

  • How do I enable multisampling and set the number of multisampling samples for a Canvas3D's GL context?

    Stuff I've found so far:

    • Canvas3DContextAttributes.antialias which however is documented as enabling an "antialiasing buffer" which I have never heard of. They probably meant to say "multisampling buffer" there? Also I found no way to specify sample count with that option.
    • "setting a QSurfaceFormat with samples greater than 0 using QQuickWindow::setFormat()". But I think this only applies to the window's GL context, and not to the Canvas3D's GL context.
      • If I were to use the Canvas3D.RenderTargetBackground or Canvas3D.RenderTargetForeground render target, then the window's multisampling buffer would be used for the Canvas3D. But I use Canvas3D.RenderTargetOffscreenBuffer.
    • glEnable(GL_MULTISAMPLE); but I think that only works after we've created a context that supports multisampling.
    • For a QQuickFramebufferObject I can set QOpenGLFramebufferObjectFormat.setSamples(4) but I'm using Canvas3D, not QQFBO

    Also, I know that my target device supports multisampling, but I don't know if it supports the extensions GL_EXT_framebuffer_multisample and GL_EXT_framebuffer_blit mentioned here. Will that be a problem, considering my render target is Canvas3D.RenderTargetOffscreenBuffer (i.e. a FBO)?