Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
ParasiteBuffer Class Reference

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. More...

`#include "parasiteBuffer.h"`

Inheritance diagram for ParasiteBuffer:

## Public Member Functions
| ParasiteBuffer (GraphicsOutput *host, const std::string &name, int x_size, int y_size, int flags)
| Normally, the ParasiteBuffer constructor is not called directly; these are created instead via the GraphicsEngine::make_parasite() function.
virtual void | begin_flip ()
| This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers.
virtual bool | begin_frame (FrameMode mode, Thread *current_thread)
| This function will be called within the draw thread before beginning rendering for a given frame.
virtual void | end_flip ()
| This function will be called within the draw thread after begin_flip() has been called on all windows, to finish the exchange of the front and back buffers.
virtual void | end_frame (FrameMode mode, Thread *current_thread)
| This function will be called within the draw thread after rendering is completed for a given frame.
virtual bool | flip_ready () const
| Returns true if a frame has been rendered and needs to be flipped, false otherwise.
virtual TypeHandle | force_init_type ()
virtual GraphicsOutput * | get_host ()
| This is normally called only from within make_texture_buffer().
virtual TypeHandle | get_type () const
virtual bool | is_active () const
| Returns true if the window is ready to be rendered into, false otherwise.
virtual void | ready_flip ()
| This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers.
void | set_size (int x, int y)
| This is called by the GraphicsEngine to request that the buffer resize itself.
void | set_size_and_recalc (int x, int y)
Public Member Functions inherited from GraphicsOutput
void | add_render_texture (Texture *tex, RenderTextureMode mode, RenderTexturePlane bitplane=RTP_COUNT)
| Creates a new Texture object, suitable for rendering the contents of this buffer into, and appends it to the list of render textures.
void | change_scenes (DisplayRegionPipelineReader *new_dr)
| Called by the GraphicsEngine when the window is about to change to another DisplayRegion.
virtual void | clear (Thread *current_thread)
| Clears the entire framebuffer before rendering, according to the settings of get_color_clear_active() and get_depth_clear_active() (inherited from DrawableRegion).
void | clear_child_sort ()
| Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value.
void | clear_delete_flag ()
| Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning of the next frame.
virtual void | clear_pipe ()
| Sets the window's _pipe pointer to NULL; this is generally called only as a precursor to deleting the window.
void | clear_render_textures ()
| If the GraphicsOutput is currently rendering to a texture, then all textures are dissociated from the GraphicsOuput.
int | count_textures () const
| If the GraphicsOutput is set to render into a texture, returns the number of textures that are being rendered into.
PointerTo< DisplayRegion > | get_active_display_region (int n) const
int | get_child_sort () const
PStatCollector & | get_clear_window_pcollector ()
| Returns a PStatCollector for timing the clear operation for just this GraphicsOutput.
PStatCollector & | get_cull_window_pcollector ()
| Returns a PStatCollector for timing the cull operation for just this GraphicsOutput.
bool | get_delete_flag () const
| Returns the current setting of the delete flag.
PointerTo< DisplayRegion > | get_display_region (int n) const
PStatCollector & | get_draw_window_pcollector ()
| Returns a PStatCollector for timing the draw operation for just this GraphicsOutput.
GraphicsEngine * | get_engine () const
const FrameBufferProperties & | get_fb_properties () const
| Returns the framebuffer properties of the window.
LVecBase2i | get_fb_size () const
int | get_fb_x_size () const
| Returns the internal width of the window or buffer.
int | get_fb_y_size () const
| Returns the internal height of the window or buffer.
GraphicsStateGuardian * | get_gsg () const
bool | get_inverted () const
unsigned int | get_left_eye_color_mask () const
| Returns the color mask in effect when rendering a left-eye view in red_blue stereo mode.
const std::string & | get_name () const
int | get_num_active_display_regions () const
int | get_num_display_regions () const
bool | get_one_shot () const
DisplayRegion * | get_overlay_display_region () const
| Returns the special "overlay" DisplayRegion that is created for each window or buffer.
GraphicsPipe * | get_pipe () const
bool | get_red_blue_stereo () const
| Returns whether red-blue stereo mode is in effect for this particular window.
unsigned int | get_right_eye_color_mask () const
| Returns the color mask in effect when rendering a right-eye view in red_blue stereo mode.
RenderTextureMode | get_rtm_mode (int i=0) const
| Returns the RenderTextureMode associated with the nth render-texture.
const LVecBase4 & | get_sbs_left_dimensions () const
| 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.
LVecBase2i | get_sbs_left_size () const
int | get_sbs_left_x_size () const
| 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().
int | get_sbs_left_y_size () const
| 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().
const LVecBase4 & | get_sbs_right_dimensions () const
| 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.
LVecBase2i | get_sbs_right_size () const
int | get_sbs_right_x_size () const
| 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().
int | get_sbs_right_y_size () const
| 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().
PointerTo< Texture > | get_screenshot ()
bool | get_screenshot (PNMImage &image)
| Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.
bool | get_side_by_side_stereo () const
| Returns whether side-by-side stereo mode is in effect for this particular window.
const LVecBase2i & | get_size () const
int | get_sort () const
virtual bool | get_supports_render_texture () const
bool | get_swap_eyes () const
virtual Texture * | get_texture (int i=0) const
| Returns the nth texture into which the GraphicsOutput renders.
NodePath | get_texture_card ()
| Returns a PandaNode containing a square polygon.
RenderTexturePlane | get_texture_plane (int i=0) const
| Returns the RenderTexturePlane associated with the nth render-texture.
int | get_x_size () const
| Returns the visible width of the window or buffer, if it is known.
int | get_y_size () const
| Returns the visible height of the window or buffer, if it is known.
bool | has_size () const
| Returns true if the size of the window/frame buffer is known, false otherwise.
bool | has_texture () const
| Returns true if the GraphicsOutput is rendering into any textures at all.
bool | is_nonzero_size () const
| Returns true if the output has a nonzero size in both X and Y, or false if it is zero (and therefore invalid).
bool | is_stereo () const
| 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.
bool | is_valid () const
| Returns true if the output is fully created and ready for rendering, false otherwise.
GraphicsOutput * | make_cube_map (const std::string &name, int size, NodePath &camera_rig, DrawMask camera_mask=PandaNode::get_all_camera_mask(), bool to_ram=false, FrameBufferProperties *fbp=nullptr)
| 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.
DisplayRegion * | make_display_region ()
| Creates a new DisplayRegion that covers the entire window.
DisplayRegion * | make_display_region (const LVecBase4 &dimensions)
| Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.
DisplayRegion * | make_display_region (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
| Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.
DisplayRegion * | make_mono_display_region ()
| Creates a new DisplayRegion that covers the entire window.
DisplayRegion * | make_mono_display_region (const LVecBase4 &dimensions)
| Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.
DisplayRegion * | make_mono_display_region (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
| Creates a new DisplayRegion that covers the entire window.
StereoDisplayRegion * | make_stereo_display_region ()
| Creates a new DisplayRegion that covers the entire window.
StereoDisplayRegion * | make_stereo_display_region (const LVecBase4 &dimensions)
| Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.
StereoDisplayRegion * | make_stereo_display_region (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
| Creates a new DisplayRegion that covers the entire window.
GraphicsOutput * | make_texture_buffer (const std::string &name, int x_size, int y_size, Texture *tex=nullptr, bool to_ram=false, FrameBufferProperties *fbp=nullptr)
| 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.
bool | operator< (const GraphicsOutput &other) const
| The sorting operator is used to order the GraphicsOutput object in order by their sort number, so that they will render in the correct order in the GraphicsEngine.
virtual void | process_events ()
| Do whatever processing in the window thread is appropriate for this output object each frame.
void | remove_all_display_regions ()
| Removes all display regions from the window, except the default one that is created with the window.
bool | remove_display_region (DisplayRegion *display_region)
| Removes the indicated DisplayRegion from the window, and destructs it if there are no other references.
virtual void | request_close ()
| This is called by the GraphicsEngine to request that the window (or whatever) close itself or, in general, make itself invalid, at the next call to process_events().
virtual void | request_open ()
| This is called by the GraphicsEngine to request that the window (or whatever) open itself or, in general, make itself valid, at the next call to process_events().
virtual void | reset_window (bool swapchain)
| Resets the window framebuffer from its derived children.
bool | save_screenshot (const Filename &filename, const std::string &image_comment="")
| Saves a screenshot of the region to the indicated filename.
Filename | save_screenshot_default (const std::string &prefix="screenshot")
| Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed.
virtual void | select_target_tex_page (int page)
| Called internally when the window is in render-to-a-texture mode and we are in the process of rendering the six faces of a cube map, or any other multi-page texture.
void | set_active (bool active)
void | set_child_sort (int child_sort)
virtual void | set_close_now ()
| This is called by the GraphicsEngine to insist that the output be closed immediately.
void | set_inverted (bool inverted)
void | set_one_shot (bool one_shot)
void | set_overlay_display_region (DisplayRegion *display_region)
| Replaces the special "overlay" DisplayRegion that is created for each window or buffer.
void | set_red_blue_stereo (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.
void | set_side_by_side_stereo (bool side_by_side_stereo)
| Enables side-by-side stereo mode on this particular window.
void | set_side_by_side_stereo (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.
void | set_size_and_recalc (int x, int y)
| Changes the x_size and y_size, then recalculates structures that depend on size.
virtual void | set_sort (int sort)
void | set_swap_eyes (bool swap_eyes)
void | setup_render_texture (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.
virtual bool | share_depth_buffer (GraphicsOutput *graphics_output)
| Will attempt to use the depth buffer of the input graphics_output.
AsyncFuture * | trigger_copy ()
| When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the next frame).
virtual void | unshare_depth_buffer ()
| Discontinue sharing the depth buffer.
Public Member Functions inherited from TypedWritableReferenceCount
| TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
void | operator= (const TypedWritableReferenceCount &copy)
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager)
| Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object.
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
virtual void | 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.
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
void | operator= (const TypedWritable &copy)
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
virtual void | write_datagram (BamWriter *manager, Datagram &dg)
| Writes the contents of this object to the datagram for shipping out to a Bam file.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from DrawableRegion
| DrawableRegion (const DrawableRegion &copy)
void | copy_clear_settings (const DrawableRegion &copy)
| Copies only the clear settings from the other drawable region.
virtual void | disable_clears ()
| Disables both the color and depth clear.
virtual bool | get_clear_active (int n) const
| Gets the clear-active flag for any bitplane.
const LColor & | get_clear_color () const
bool | get_clear_color_active () const
| Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
PN_stdfloat | get_clear_depth () const
bool | get_clear_depth_active () const
| Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame.
unsigned int | get_clear_stencil () const
bool | get_clear_stencil_active () const
| Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
virtual const LColor & | get_clear_value (int n) const
| Returns the clear value for any bitplane.
int | get_draw_buffer_type () const
| Returns the RenderBuffer into which the GSG should issue draw commands.
PN_stdfloat | get_pixel_factor () const
PN_stdfloat | get_pixel_zoom () const
int | get_screenshot_buffer_type () const
| Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion.
virtual bool | is_any_clear_active () const
| 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.
void | operator= (const DrawableRegion &copy)
virtual void | set_clear_active (int n, bool clear_aux_active)
| Sets the clear-active flag for any bitplane.
void | set_clear_color (const LColor &color)
void | set_clear_color_active (bool clear_color_active)
| Toggles the flag that indicates whether the color buffer should be cleared every frame.
void | set_clear_depth (PN_stdfloat depth)
void | set_clear_depth_active (bool clear_depth_active)
| Toggles the flag that indicates whether the depth buffer should be cleared every frame.
void | set_clear_stencil (unsigned int stencil)
void | set_clear_stencil_active (bool clear_stencil_active)
| Toggles the flag that indicates whether the stencil buffer should be cleared every frame.
virtual void | set_clear_value (int n, const LColor &clear_value)
| Sets the clear value for any bitplane.
virtual void | set_pixel_zoom (PN_stdfloat pixel_zoom)
virtual bool | supports_pixel_zoom () const
| Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from GraphicsOutput
static TypeHandle | get_class_type ()
static void | init_type ()
static Filename | make_screenshot_filename (const std::string &prefix="screenshot")
| Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed.
Static Public Member Functions inherited from GraphicsOutputBase
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes.
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from DrawableRegion
static int | get_renderbuffer_type (int plane)
| Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane.

## Additional Inherited Members
Public Types inherited from GraphicsOutput
enum | FrameMode { FM_render , FM_parasite , FM_refresh }
enum | RenderTextureMode { RTM_none , RTM_bind_or_copy , RTM_copy_texture , RTM_copy_ram , RTM_triggered_copy_texture , RTM_triggered_copy_ram , RTM_bind_layered }
Public Types inherited from DrawableRegion
enum | RenderTexturePlane { RTP_stencil =0 , RTP_depth_stencil =1 , RTP_color , RTP_aux_rgba_0 , RTP_aux_rgba_1 , RTP_aux_rgba_2 , RTP_aux_rgba_3 , RTP_aux_hrgba_0 , RTP_aux_hrgba_1 , RTP_aux_hrgba_2 , RTP_aux_hrgba_3 , RTP_aux_float_0 , RTP_aux_float_1 , RTP_aux_float_2 , RTP_aux_float_3 , RTP_depth , RTP_COUNT }
Public Attributes inherited from GraphicsOutput
| get_active_display_region
| Returns the nth active DisplayRegion of those that have been created within the window.
| get_child_sort
| Returns the sort value of future offscreen buffers created by make_texture_sort().
| get_display_region
| Returns the nth DisplayRegion of those that have been created within the window.
| get_engine
| Returns the graphics engine that created this output.
| get_fb_size
| Returns the internal size of the window or buffer.
| get_gsg
| Returns the GSG that is associated with this window.
| get_inverted
| Returns the current setting of the inverted flag.
| get_name
| Returns the name that was passed to the GraphicsOutput constructor.
| get_num_active_display_regions
| Returns the number of active DisplayRegions that have been created within the window.
| get_num_display_regions
| Returns the number of DisplayRegions that have been created within the window, active or otherwise.
| get_one_shot
| Returns the current setting of the one-shot flag.
| get_pipe
| Returns the GraphicsPipe that this window is associated with.
| get_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().
| get_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().
| get_size
| Returns the visible size of the window or buffer, if it is known.
| get_sort
| Returns the sorting order of this particular GraphicsOutput.
| get_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.
| get_swap_eyes
| Returns the current setting of the "swap eyes" flag.
| is_active
| Returns true if the window is ready to be rendered into, false otherwise.
| set_active
| Sets the active flag associated with the GraphicsOutput.
| set_child_sort
| Specifies the sort value of future offscreen buffers created by make_texture_sort().
| set_inverted
| Changes the current setting of the inverted flag.
| set_one_shot
| Changes the current setting of the one-shot flag.
| set_sort
| Adjusts the sorting order of this particular GraphicsOutput, relative to other GraphicsOutputs.
| set_swap_eyes
| Changes the "swap eyes" flag.
Public Attributes inherited from TypedWritableReferenceCount
static BamReader * | reader = nullptr)
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.
Public Attributes inherited from DrawableRegion
| get_clear_color
| Returns the current clear color value.
| get_clear_depth
| Returns the current clear depth value.
| get_clear_stencil
| Returns the current clear stencil value.
| get_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().
| get_pixel_zoom
| Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not.
| set_clear_color
| Sets the clear color to the indicated value.
| set_clear_depth
| Sets the clear depth to the indicated value.
| set_clear_stencil
| Sets the clear stencil to the indicated value.
| set_pixel_zoom
| Sets the amount by which the pixels of the region are scaled internally when filling the image interally.
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

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.

Definition at line 43 of file parasiteBuffer.h.

## Constructor & Destructor Documentation

## ◆ ParasiteBuffer()

ParasiteBuffer::ParasiteBuffer | ( | GraphicsOutput * | host,
|  | const std::string & | name,
|  | int | x_size,
|  | int | y_size,
|  | int | flags )

Normally, the ParasiteBuffer constructor is not called directly; these are created instead via the GraphicsEngine::make_parasite() function.

Definition at line 23 of file parasiteBuffer.cxx.

References GraphicsOutput::get_engine, GraphicsOutput::get_fb_properties(), GraphicsOutput::get_gsg, GraphicsOutput::get_name, GraphicsOutput::get_pipe, GraphicsOutput::get_size, GraphicsOutput::set_inverted, and MemoryUsage::update_type().

## ◆ ~ParasiteBuffer()

ParasiteBuffer::~ParasiteBuffer | ( |  | ) |
| virtual

Definition at line 59 of file parasiteBuffer.cxx.

## Member Function Documentation

## ◆ begin_flip()

void ParasiteBuffer::begin_flip | ( |  | ) |
| virtual

This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers.

This should instruct the window to prepare for the flip at the next video sync, but it should not wait.

We have the two separate functions, begin_flip() and end_flip(), to make it easier to flip all of the windows at the same time.

Reimplemented from GraphicsOutput.

Definition at line 126 of file parasiteBuffer.cxx.

## ◆ begin_frame()

bool ParasiteBuffer::begin_frame | ( | FrameMode | mode,
|  | Thread * | current_thread )
| virtual

This function will be called within the draw thread before beginning rendering for a given frame.

It should do whatever setup is required, and return true if the frame should be rendered, or false if it should be skipped.

Reimplemented from GraphicsOutput.

Definition at line 167 of file parasiteBuffer.cxx.

References GraphicsOutput::get_x_size(), and GraphicsOutput::get_y_size().

## ◆ end_flip()

void ParasiteBuffer::end_flip | ( |  | ) |
| virtual

This function will be called within the draw thread after begin_flip() has been called on all windows, to finish the exchange of the front and back buffers.

This should cause the window to wait for the flip, if necessary.

Reimplemented from GraphicsOutput.

Definition at line 154 of file parasiteBuffer.cxx.

## ◆ end_frame()

void ParasiteBuffer::end_frame | ( | FrameMode | mode,
|  | Thread * | current_thread )
| virtual

This function will be called within the draw thread after rendering is completed for a given frame.

It should do whatever finalization is required.

Reimplemented from GraphicsOutput.

Definition at line 197 of file parasiteBuffer.cxx.

## ◆ flip_ready()

bool ParasiteBuffer::flip_ready | ( |  | ) | const
| virtual

Returns true if a frame has been rendered and needs to be flipped, false otherwise.

Reimplemented from GraphicsOutput.

Definition at line 109 of file parasiteBuffer.cxx.

## ◆ force_init_type()

virtual TypeHandle ParasiteBuffer::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from GraphicsOutput.

Definition at line 80 of file parasiteBuffer.h.

## ◆ get_class_type()

static TypeHandle ParasiteBuffer::get_class_type | ( |  | ) |
| inline static

Definition at line 69 of file parasiteBuffer.h.

## ◆ get_host()

GraphicsOutput * ParasiteBuffer::get_host | ( |  | ) |
| virtual

This is normally called only from within make_texture_buffer().

When called on a ParasiteBuffer, it returns the host of that buffer; but when called on some other buffer, it returns the buffer itself.

Reimplemented from GraphicsOutput.

Definition at line 221 of file parasiteBuffer.cxx.

## ◆ get_type()

virtual TypeHandle ParasiteBuffer::get_type | ( |  | ) | const
| inline virtual

Reimplemented from GraphicsOutput.

Definition at line 77 of file parasiteBuffer.h.

## ◆ init_type()

static void ParasiteBuffer::init_type | ( |  | ) |
| inline static

Definition at line 72 of file parasiteBuffer.h.

## ◆ is_active()

bool ParasiteBuffer::is_active | ( |  | ) | const
| virtual

Returns true if the window is ready to be rendered into, false otherwise.

Reimplemented from GraphicsOutput.

Definition at line 67 of file parasiteBuffer.cxx.

References GraphicsOutput::is_active.

## ◆ ready_flip()

void ParasiteBuffer::ready_flip | ( |  | ) |
| virtual

This function will be called within the draw thread after end_frame() has been called on all windows, to initiate the exchange of the front and back buffers.

This should instruct the window to prepare for the flip when it is command but not actually flip

Reimplemented from GraphicsOutput.

Definition at line 141 of file parasiteBuffer.cxx.

## ◆ set_size()

void ParasiteBuffer::set_size | ( | 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.

Definition at line 78 of file parasiteBuffer.cxx.

## ◆ set_size_and_recalc()

void ParasiteBuffer::set_size_and_recalc | ( | int | x,
|  | int | y )

Definition at line 90 of file parasiteBuffer.cxx.

The documentation for this class was generated from the following files:

- panda/src/display/parasiteBuffer.h
- panda/src/display/parasiteBuffer.cxx