Пример #1
0
def create_fbo(ctx: moderngl.Context,
               size: Size,
               components: int = 4) -> moderngl.Framebuffer:
    """Create a Frame Buffer Object (fbo) with the given size and
    color components"""
    return ctx.framebuffer(
        color_attachments=[ctx.renderbuffer(size, components)],
        depth_attachment=ctx.depth_renderbuffer(size))
Пример #2
0
 def get_fbo(self,
             ctx: moderngl.Context,
             samples: int = 0) -> moderngl.Framebuffer:
     pw = self.pixel_width
     ph = self.pixel_height
     return ctx.framebuffer(color_attachments=ctx.texture(
         (pw, ph),
         components=self.n_channels,
         samples=samples,
     ),
                            depth_attachment=ctx.depth_renderbuffer(
                                (pw, ph), samples=samples))