Renderbuffer

class moderngl.Renderbuffer

Renderbuffer objects are OpenGL objects that contain images.

They are created and used specifically with Framebuffer objects. They are optimized for use as render targets, while Texture objects 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() or Context.depth_renderbuffer() to create one.

Create

Context.renderbuffer(size: Tuple[int, int], components: int = 4, *, samples: int = 0, dtype: str = 'f1') Renderbuffer

Renderbuffer objects are OpenGL objects that contain images. They are created and used specifically with Framebuffer objects.

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:

Renderbuffer object

Context.depth_renderbuffer(size: Tuple[int, int], *, samples: int = 0) Renderbuffer

Renderbuffer objects are OpenGL objects that contain images. They are created and used specifically with Framebuffer objects.

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:

Renderbuffer object

Methods

Renderbuffer.release() None

Release the ModernGL object.

Attributes

Renderbuffer.width

The width of the renderbuffer.

Type:

int

Renderbuffer.height

The height of the renderbuffer.

Type:

int

Renderbuffer.size

The size of the renderbuffer.

Type:

tuple

Renderbuffer.samples

The samples of the renderbuffer.

Type:

int

Renderbuffer.components

The components of the renderbuffer.

Type:

int

Renderbuffer.depth

Is the renderbuffer a depth renderbuffer?.

Type:

bool

Renderbuffer.dtype

Data type.

Type:

str

Renderbuffer.glo

The internal OpenGL object.

This values is provided for debug purposes only.

Type:

int

Renderbuffer.mglo

Internal representation for debug purposes only.

Renderbuffer.extra

Any - Attribute for storing user defined objects

Renderbuffer.ctx

The context this object belongs to