Renderbuffer#
- class moderngl.Renderbuffer#
Renderbuffer objects are OpenGL objects that contain images.
They are created and used specifically with
Framebufferobjects. They are optimized for use as render targets, whileTextureobjects may not be, and are the logical choice when you do not need to sample from the produced image. If you need to resample, use Textures instead. Renderbuffer objects also natively accommodate multisampling.A Renderbuffer object cannot be instantiated directly, it requires a context. Use
Context.renderbuffer()orContext.depth_renderbuffer()to create one.
Create#
- Context.renderbuffer(size: Tuple[int, int], components: int = 4, *, samples: int = 0, dtype: str = 'f1') moderngl.Renderbuffer
Renderbufferobjects are OpenGL objects that contain images. They are created and used specifically withFramebufferobjects.- Parameters
size (tuple) – The width and height of the renderbuffer.
components (int) – The number of components 1, 2, 3 or 4.
- Keyword Arguments
samples (int) – The number of samples. Value 0 means no multisample format.
dtype (str) – Data type.
- Returns
Renderbufferobject
- Context.depth_renderbuffer(size: Tuple[int, int], *, samples: int = 0) moderngl.Renderbuffer
Renderbufferobjects are OpenGL objects that contain images. They are created and used specifically withFramebufferobjects.- Parameters
size (tuple) – The width and height of the renderbuffer.
- Keyword Arguments
samples (int) – The number of samples. Value 0 means no multisample format.
- Returns
Renderbufferobject
Methods#
- Renderbuffer.release() None#
Release the ModernGL object.
Attributes#
- Renderbuffer.width: int#
The width of the renderbuffer.
- Type
int
- Renderbuffer.height: int#
The height of the renderbuffer.
- Type
int
- Renderbuffer.size: tuple#
The size of the renderbuffer.
- Type
tuple
- Renderbuffer.samples: int#
The samples of the renderbuffer.
- Type
int
- Renderbuffer.components: int#
The components of the renderbuffer.
- Type
int
- Renderbuffer.depth: bool#
Is the renderbuffer a depth renderbuffer?.
- Type
bool
- Renderbuffer.dtype: str#
Data type.
- Type
str
- Renderbuffer.glo: int#
The internal OpenGL object.
This values is provided for debug purposes only.
- Type
int
- Renderbuffer.mglo: Any#
Internal representation for debug purposes only.
- Renderbuffer.extra: Any#
Any - Attribute for storing user defined objects
- Renderbuffer.ctx: moderngl.Context#
The context this object belongs to