panda3d.core.ParasiteBuffer

class ParasiteBuffer

Bases: GraphicsOutput

This is a special GraphicsOutput type that acts a lot like a GraphicsBuffer, effectively allowing rendering to an offscreen buffer, except it does not create any framebuffer space for itself. Instead, it renders into the framebuffer owned by some other GraphicsOutput.

The x_size and y_size must therefore fit within the bounds of the source GraphicsOutput.

Since the framebuffer will be subsequently cleared when the actual owner draws in it later, this only makes sense if we are going to copy the contents of the framebuffer to a texture immediately after we draw it. Thus, has_texture() is implicitly true for a ParasiteBuffer.

This class is useful to render offscreen to a texture while preventing the waste of framebuffer memory for API’s that are unable to render directly into a texture (and must render into a separate framebuffer first and then copy to texture). It is also the only way to render to a texture on API’s that do not support offscreen rendering.

Inheritance diagram

Inheritance diagram of ParasiteBuffer

static getClassType() → TypeHandle
Return type

TypeHandle

setSize(x: int, y: int) → None

This is called by the GraphicsEngine to request that the buffer resize itself. Although calls to get the size will return the new value, much of the actual resizing work doesn’t take place until the next begin_frame. Not all buffers are resizeable.