Example #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))
Example #2
0
File: camera.py Project: 3b1b/manim
 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))