vispy.gloo.framebuffer module#

class vispy.gloo.framebuffer.FrameBuffer(color=None, depth=None, stencil=None)#

Bases: GLObject

Frame buffer object

colorRenderBuffer (optional)

The color buffer to attach to this frame buffer

depthRenderBuffer (optional)

The depth buffer to attach to this frame buffer

stencilRenderBuffer (optional)

The stencil buffer to attach to this frame buffer


Activate/use this frame buffer.

property color_buffer#

Color buffer attachment


Stop using this frame buffer, the previous framebuffer will be made active.

property depth_buffer#

Depth buffer attachment

read(mode='color', alpha=True, crop=None)#

Return array of pixel values in an attached buffer


The buffer type to read. May be ‘color’, ‘depth’, or ‘stencil’.


If True, returns RGBA array. Otherwise, returns RGB.


If not None, specifies pixels to read from buffer. Format is (x, y, w, h).


3D array of pixels in np.uint8 format. The array shape is (h, w, 3) or (h, w, 4), with the top-left corner of the framebuffer at index [0, 0] in the returned array if crop was not specified. If crop was given, the result will match the offset and dimensions of the crop.


Resize all attached buffers with the given shape

shapetuple of two integers

New buffer shape (h, w), to be applied to all currently attached buffers. For buffers that are a texture, the number of color channels is preserved.

property shape#

The shape of the Texture/RenderBuffer attached to this FrameBuffer

property stencil_buffer#

Stencil buffer attachment

class vispy.gloo.framebuffer.RenderBuffer(shape=None, format=None, resizeable=True)#

Bases: GLObject

Base class for render buffer object

A render buffer can be in color, depth or stencil format. If this format is not specified, it is set when attached to the FrameBuffer.


The shape of the render buffer.

format{None, ‘color’, ‘depth’, ‘stencil’}

The format of the render buffer. See resize.


Indicates whether texture can be resized

property format#

Render Buffer format

resize(shape, format=None)#

Set the render-buffer size and format

shapetuple of integers

New shape in yx order. A render buffer is always 2D. For symmetry with the texture class, a 3-element tuple can also be given, in which case the last dimension is ignored.

format{None, ‘color’, ‘depth’, ‘stencil’}

The buffer format. If None, the current format is maintained. If that is also None, the format will be set upon attaching it to a framebuffer. One can also specify the explicit enum: GL_RGB565, GL_RGBA4, GL_RGB5_A1, GL_DEPTH_COMPONENT16, or GL_STENCIL_INDEX8

property shape#

Render Buffer shape