Skip to content Skip to sidebar Skip to footer

How To Add A Depth Buffer In Moderngl Egl Backend?

This code renders a colored triangle with anti-aliasing (samples=8) when a depth buffer line depth_attachment=ctx.depth_texture((512, 512), samples=8) is commented. But when I add

Solution 1:

It works when using a Renderbuffer rather than a Texture for the multisample depth buffer:

Instead of

fbo_msaa = ctx.framebuffer(
       color_attachments=ctx.texture((512, 512), 4, samples=8),
       depth_attachment=ctx.depth_texture((512, 512), samples=8)
   )

do

fbo_msaa = ctx.framebuffer(
        color_attachments=ctx.texture((512, 512), 4, samples=8),
        depth_attachment=ctx.depth_renderbuffer((512, 512), samples=8)
    )

This seams to be a bug in ModernGL, related to multisample texture depth buffer attachment. Furthermore error 1280 (GL_INVALID_ENUM) does not make any sense, GL_READ_FRAMEBUFFER is a valid argument for glBindFramebuffer.

Post a Comment for "How To Add A Depth Buffer In Moderngl Egl Backend?"