Panda3D
Public Member Functions | Static Public Member Functions | List of all members
GraphicsBuffer Class Reference

An offscreen buffer for rendering into. More...

Inheritance diagram for GraphicsBuffer:
GraphicsOutput GraphicsOutputBase DrawableRegion TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

Public Member Functions

 setSize (int x, int y)
 This is called by the GraphicsEngine to request that the buffer resize itself. More...
 
- Public Member Functions inherited from GraphicsOutput
 addRenderTexture (Texture tex, GraphicsOutput::RenderTextureMode mode, DrawableRegion::RenderTexturePlane bitplane)
 Creates a new Texture object, suitable for rendering the contents of this buffer into, and appends it to the list of render textures. More...
 
 clearChildSort ()
 Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value. More...
 
 clearDeleteFlag ()
 Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning of the next frame. More...
 
 clearRenderTextures ()
 If the GraphicsOutput is currently rendering to a texture, then all textures are dissociated from the GraphicsOuput. More...
 
int countTextures ()
 If the GraphicsOutput is set to render into a texture, returns the number of textures that are being rendered into. More...
 
bool flipReady ()
 
DisplayRegion getActiveDisplayRegion (int n)
 Returns the nth active DisplayRegion of those that have been created within the window. More...
 
list getActiveDisplayRegions ()
 
int getChildSort ()
 Returns the sort value of future offscreen buffers created by make_texture_sort(). More...
 
bool getDeleteFlag ()
 Returns the current setting of the delete flag. More...
 
DisplayRegion getDisplayRegion (int n)
 Returns the nth DisplayRegion of those that have been created within the window. More...
 
list getDisplayRegions ()
 
GraphicsEngine getEngine ()
 Returns the graphics engine that created this output. More...
 
const FrameBufferProperties getFbProperties ()
 Returns the framebuffer properties of the window. More...
 
LVecBase2i getFbSize ()
 Returns the internal size of the window or buffer. More...
 
int getFbXSize ()
 Returns the internal width of the window or buffer. More...
 
int getFbYSize ()
 Returns the internal height of the window or buffer. More...
 
GraphicsStateGuardian getGsg ()
 Returns the GSG that is associated with this window. More...
 
GraphicsOutput getHost ()
 This is normally called only from within make_texture_buffer(). More...
 
bool getInverted ()
 Returns the current setting of the inverted flag. More...
 
unsigned int getLeftEyeColorMask ()
 Returns the color mask in effect when rendering a left-eye view in red_blue stereo mode. More...
 
str getName ()
 Returns the name that was passed to the GraphicsOutput constructor. More...
 
int getNumActiveDisplayRegions ()
 Returns the number of active DisplayRegions that have been created within the window. More...
 
int getNumDisplayRegions ()
 Returns the number of DisplayRegions that have been created within the window, active or otherwise. More...
 
bool getOneShot ()
 Returns the current setting of the one-shot flag. More...
 
DisplayRegion getOverlayDisplayRegion ()
 Returns the special "overlay" DisplayRegion that is created for each window or buffer. More...
 
GraphicsPipe getPipe ()
 Returns the GraphicsPipe that this window is associated with. More...
 
bool getRedBlueStereo ()
 Returns whether red-blue stereo mode is in effect for this particular window. More...
 
unsigned int getRightEyeColorMask ()
 Returns the color mask in effect when rendering a right-eye view in red_blue stereo mode. More...
 
GraphicsOutput::RenderTextureMode getRtmMode (int i)
 Returns the RenderTextureMode associated with the nth render-texture. More...
 
const LVecBase4 getSbsLeftDimensions ()
 Returns the effective sub-region of the window for displaying the left channel, if side-by-side stereo mode is in effect for the window. More...
 
LVecBase2i getSbsLeftSize ()
 If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_size() by get_sbs_left_dimensions(). More...
 
int getSbsLeftXSize ()
 If side-by-side stereo is enabled, this returns the pixel width of the left eye, based on scaling get_x_size() by get_sbs_left_dimensions(). More...
 
int getSbsLeftYSize ()
 If side-by-side stereo is enabled, this returns the pixel height of the left eye, based on scaling get_y_size() by get_sbs_left_dimensions(). More...
 
const LVecBase4 getSbsRightDimensions ()
 Returns the effective sub-region of the window for displaying the right channel, if side-by-side stereo mode is in effect for the window. More...
 
LVecBase2i getSbsRightSize ()
 If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get_size() by get_sbs_right_dimensions(). More...
 
int getSbsRightXSize ()
 If side-by-side stereo is enabled, this returns the pixel width of the right eye, based on scaling get_x_size() by get_sbs_right_dimensions(). More...
 
int getSbsRightYSize ()
 If side-by-side stereo is enabled, this returns the pixel height of the right eye, based on scaling get_y_size() by get_sbs_right_dimensions(). More...
 
Texture getScreenshot ()
 Captures the most-recently rendered image from the framebuffer and returns it as Texture, or NULL on failure. More...
 
bool getScreenshot (PNMImage image)
 Captures the most-recently rendered image from the framebuffer into the indicated PNMImage. More...
 
bool getSideBySideStereo ()
 Returns whether side-by-side stereo mode is in effect for this particular window. More...
 
const LVecBase2i getSize ()
 Returns the visible size of the window or buffer, if it is known. More...
 
int getSort ()
 Returns the sorting order of this particular GraphicsOutput. More...
 
bool getSupportsRenderTexture ()
 Returns true if this particular GraphicsOutput can render directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. More...
 
bool getSwapEyes ()
 Returns the current setting of the "swap eyes" flag. More...
 
Texture getTexture (int i)
 Returns the nth texture into which the GraphicsOutput renders. More...
 
NodePath getTextureCard ()
 Returns a PandaNode containing a square polygon. More...
 
DrawableRegion::RenderTexturePlane getTexturePlane (int i)
 Returns the RenderTexturePlane associated with the nth render-texture. More...
 
int getXSize ()
 Returns the visible width of the window or buffer, if it is known. More...
 
int getYSize ()
 Returns the visible height of the window or buffer, if it is known. More...
 
bool hasSize ()
 Returns true if the size of the window/frame buffer is known, false otherwise. More...
 
bool hasTexture ()
 Returns true if the GraphicsOutput is rendering into any textures at all. More...
 
bool isActive ()
 Returns true if the window is ready to be rendered into, false otherwise. More...
 
bool isNonzeroSize ()
 Returns true if the output has a nonzero size in both X and Y, or false if it is zero (and therefore invalid). More...
 
bool isStereo ()
 Returns Returns true if this window can render stereo DisplayRegions, either through red-blue stereo (see set_red_blue_stereo()) or through true hardware stereo rendering. More...
 
bool isValid ()
 Returns true if the output is fully created and ready for rendering, false otherwise. More...
 
GraphicsOutput makeCubeMap (str name, int size, NodePath camera_rig, DrawMask camera_mask, bool to_ram, FrameBufferProperties fbp)
 This is similar to make_texture_buffer() in that it allocates a separate buffer suitable for rendering to a texture that can be assigned to geometry in this window, but in this case, the buffer is set up to render the six faces of a cube map. More...
 
DisplayRegion makeDisplayRegion ()
 Creates a new DisplayRegion that covers the entire window. More...
 
DisplayRegion makeDisplayRegion (const LVecBase4 dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
DisplayRegion makeDisplayRegion (float l, float r, float b, float t)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
DisplayRegion makeMonoDisplayRegion ()
 Creates a new DisplayRegion that covers the entire window. More...
 
DisplayRegion makeMonoDisplayRegion (const LVecBase4 dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
DisplayRegion makeMonoDisplayRegion (float l, float r, float b, float t)
 Creates a new DisplayRegion that covers the entire window. More...
 
StereoDisplayRegion makeStereoDisplayRegion ()
 Creates a new DisplayRegion that covers the entire window. More...
 
StereoDisplayRegion makeStereoDisplayRegion (const LVecBase4 dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
StereoDisplayRegion makeStereoDisplayRegion (float l, float r, float b, float t)
 Creates a new DisplayRegion that covers the entire window. More...
 
GraphicsOutput makeTextureBuffer (str name, int x_size, int y_size, Texture tex, bool to_ram, FrameBufferProperties fbp)
 Creates and returns an offscreen buffer for rendering into, the result of which will be a texture suitable for applying to geometry within the scene rendered into this window. More...
 
 removeAllDisplayRegions ()
 Removes all display regions from the window, except the default one that is created with the window. More...
 
bool removeDisplayRegion (DisplayRegion display_region)
 Removes the indicated DisplayRegion from the window, and destructs it if there are no other references. More...
 
bool saveScreenshot (const Filename filename, str image_comment)
 Saves a screenshot of the region to the indicated filename. More...
 
Filename saveScreenshotDefault (str prefix)
 Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed. More...
 
 setActive (bool active)
 Sets the active flag associated with the GraphicsOutput. More...
 
 setChildSort (int child_sort)
 Specifies the sort value of future offscreen buffers created by make_texture_sort(). More...
 
 setInverted (bool inverted)
 Changes the current setting of the inverted flag. More...
 
 setOneShot (bool one_shot)
 Changes the current setting of the one-shot flag. More...
 
 setOverlayDisplayRegion (DisplayRegion display_region)
 Replaces the special "overlay" DisplayRegion that is created for each window or buffer. More...
 
 setRedBlueStereo (bool red_blue_stereo, unsigned int left_eye_color_mask, unsigned int right_eye_color_mask)
 Enables red-blue stereo mode on this particular window. More...
 
 setSideBySideStereo (bool side_by_side_stereo)
 Enables side-by-side stereo mode on this particular window. More...
 
 setSideBySideStereo (bool side_by_side_stereo, const LVecBase4 sbs_left_dimensions, const LVecBase4 sbs_right_dimensions)
 Enables side-by-side stereo mode on this particular window. More...
 
 setSort (int sort)
 Adjusts the sorting order of this particular GraphicsOutput, relative to other GraphicsOutputs. More...
 
 setSwapEyes (bool swap_eyes)
 Changes the "swap eyes" flag. More...
 
 setupRenderTexture (Texture tex, bool allow_bind, bool to_ram)
 This is a deprecated interface that made sense back when GraphicsOutputs could only render into one texture at a time. More...
 
bool shareDepthBuffer (GraphicsOutput graphics_output)
 Will attempt to use the depth buffer of the input graphics_output. More...
 
AsyncFuture triggerCopy ()
 When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the next frame). More...
 
 unshareDepthBuffer ()
 Discontinue sharing the depth buffer. More...
 
- Public Member Functions inherited from GraphicsOutputBase
Texture getTexture (int i)
 
 setSort (int sort)
 
- Public Member Functions inherited from TypedWritable
object __reduce__ ()
 
object __reduce_persist__ (object pickler)
 
VectorUchar encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encodeToBamStream (VectorUchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
 fillin (DatagramIterator scan, BamReader manager)
 This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
 
UpdateSeq getBamModified ()
 Returns the current bam_modified counter. More...
 
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 
- Public Member Functions inherited from DrawableRegion
 disableClears ()
 Disables both the color and depth clear. More...
 
bool getClearActive (int n)
 Gets the clear-active flag for any bitplane. More...
 
const LColor getClearColor ()
 Returns the current clear color value. More...
 
bool getClearColorActive ()
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
float getClearDepth ()
 Returns the current clear depth value. More...
 
bool getClearDepthActive ()
 Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. More...
 
unsigned int getClearStencil ()
 Returns the current clear stencil value. More...
 
bool getClearStencilActive ()
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
const LColor getClearValue (int n)
 Returns the clear value for any bitplane. More...
 
float getPixelFactor ()
 Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom(). More...
 
float getPixelZoom ()
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More...
 
bool isAnyClearActive ()
 Returns true if any of the clear types (so far there are just color or depth) have been set active, or false if none of them are active and there is no need to clear. More...
 
 setClearActive (int n, bool clear_aux_active)
 Sets the clear-active flag for any bitplane. More...
 
 setClearColor (const LColor color)
 Sets the clear color to the indicated value. More...
 
 setClearColorActive (bool clear_color_active)
 Toggles the flag that indicates whether the color buffer should be cleared every frame. More...
 
 setClearDepth (float depth)
 Sets the clear depth to the indicated value. More...
 
 setClearDepthActive (bool clear_depth_active)
 Toggles the flag that indicates whether the depth buffer should be cleared every frame. More...
 
 setClearStencil (unsigned int stencil)
 
 setClearStencilActive (bool clear_stencil_active)
 Toggles the flag that indicates whether the stencil buffer should be cleared every frame. More...
 
 setClearValue (int n, const LColor clear_value)
 Sets the clear value for any bitplane. More...
 
 setPixelZoom (float pixel_zoom)
 Sets the amount by which the pixels of the region are scaled internally when filling the image interally. More...
 
bool supportsPixelZoom ()
 Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from GraphicsOutput
static TypeHandle getClassType ()
 
static Filename makeScreenshotFilename (str prefix)
 Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed. More...
 
- Static Public Member Functions inherited from GraphicsOutputBase
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypedWritableReferenceCount decodeFromBamStream (VectorUchar data, BamReader reader)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritable
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from DrawableRegion
static int getRenderbufferType (int plane)
 Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane. More...
 

Additional Inherited Members

- Public Types inherited from GraphicsOutput
enum  FrameMode { FM_render = 0, FM_parasite = 1, FM_refresh = 2 }
 
enum  RenderTextureMode {
  RTM_none = 0, RTM_bind_or_copy = 1, RTM_copy_texture = 2, RTM_copy_ram = 3,
  RTM_triggered_copy_texture = 4, RTM_triggered_copy_ram = 5, RTM_bind_layered = 6
}
 
- Public Types inherited from DrawableRegion
enum  RenderTexturePlane {
  RTP_stencil = 0, RTP_depth_stencil = 1, RTP_color = 2, RTP_aux_rgba_0 = 3,
  RTP_aux_rgba_1 = 4, RTP_aux_rgba_2 = 5, RTP_aux_rgba_3 = 6, RTP_aux_hrgba_0 = 7,
  RTP_aux_hrgba_1 = 8, RTP_aux_hrgba_2 = 9, RTP_aux_hrgba_3 = 10, RTP_aux_float_0 = 11,
  RTP_aux_float_1 = 12, RTP_aux_float_2 = 13, RTP_aux_float_3 = 14, RTP_depth = 15,
  RTP_COUNT = 16
}
 
- Public Attributes inherited from GraphicsOutput
bool active
 Returns true if the window is ready to be rendered into, false otherwise. More...
 
PointerToDisplayRegion active_display_regions []
 
int child_sort
 Returns the sort value of future offscreen buffers created by make_texture_sort(). More...
 
PointerToDisplayRegion display_regions []
 
GraphicsEngine engine
 Returns the graphics engine that created this output. More...
 
LVecBase2i fb_size
 Returns the internal size of the window or buffer. More...
 
GraphicsStateGuardian gsg
 Returns the GSG that is associated with this window. More...
 
bool inverted
 Returns the current setting of the inverted flag. More...
 
const String name
 Returns the name that was passed to the GraphicsOutput constructor. More...
 
bool one_shot
 Returns the current setting of the one-shot flag. More...
 
GraphicsPipe pipe
 Returns the GraphicsPipe that this window is associated with. More...
 
LVecBase2i sbs_left_size
 If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_size() by get_sbs_left_dimensions(). More...
 
LVecBase2i sbs_right_size
 If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get_size() by get_sbs_right_dimensions(). More...
 
const LVecBase2i size
 Returns the visible size of the window or buffer, if it is known. More...
 
int sort
 Returns the sorting order of this particular GraphicsOutput. More...
 
bool supports_render_texture
 Returns true if this particular GraphicsOutput can render directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. More...
 
bool swap_eyes
 Returns the current setting of the "swap eyes" flag. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 
- Public Attributes inherited from DrawableRegion
const LColor clear_color
 Returns the current clear color value. More...
 
float clear_depth
 Returns the current clear depth value. More...
 
unsigned int clear_stencil
 Returns the current clear stencil value. More...
 
float pixel_factor
 Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom(). More...
 
float pixel_zoom
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More...
 

Detailed Description

An offscreen buffer for rendering into.

This is similar in function to a GraphicsWindow, except that the output is not visible to the user.

Member Function Documentation

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ setSize()

setSize ( int  x,
int  y 
)

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.