pyglet.image.buffer
OpenGL Framebuffer abstractions.
This module provides classes for working with Framebuffers & Renderbuffers and their attachments. Attachments can be pyglet Texture objects, which allows easily accessing their data, saving to disk, etc. Renderbuffers can be used if you don’t need to access their data at a later time. For example:
# Create two objects to use as attachments for our Framebuffer.
color_buffer = pyglet.image.Texture.create(width, height, min_filter=GL_NEAREST, mag_filter=GL_NEAREST)
depth_buffer = pyglet.image.buffer.Renderbuffer(width, height, GL_DEPTH_COMPONENT)
# Create a framebuffer object, and attach the two buffers:
framebuffer = pyglet.image.Framebuffer()
framebuffer.attach_texture(color_buffer, attachment=GL_COLOR_ATTACHMENT0)
framebuffer.attach_renderbuffer(depth_buffer, attachment=GL_DEPTH_ATTACHMENT)
# Bind the Framebuffer, which sets it as the active render target:
framebuffer.bind()
See the OpenGL documentation for more information on valid attachment types and targets.
- class Framebuffer
OpenGL Framebuffer Object.
Added in version 2.0.
- property height: int
The height of the tallest attachment.
- property id: int
The Framebuffer id.
- property is_complete: bool
True if the framebuffer is ‘complete’, else False.
- property width: int
The width of the widest attachment.