Panda3D
 All Classes Functions Variables Enumerations
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
GraphicsOutput Class Reference

This is a base class for the various different classes that represent the result of a frame of rendering. More...

#include "graphicsOutput.h"

Inheritance diagram for GraphicsOutput:
GraphicsOutputBase DrawableRegion TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase GraphicsBuffer GraphicsWindow ParasiteBuffer eglGraphicsBuffer eglGraphicsPixmap glxGraphicsBuffer glxGraphicsPixmap osxGraphicsBuffer TinyGraphicsBuffer wdxGraphicsBuffer9 wglGraphicsBuffer AndroidGraphicsWindow CallbackGraphicsWindow CocoaGraphicsWindow eglGraphicsWindow IPhoneGraphicsWindow osxGraphicsWindow WinGraphicsWindow x11GraphicsWindow

Public Types

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 Member Functions

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. More...
 
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. More...
 
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. More...
 
void change_scenes (DisplayRegionPipelineReader *new_dr)
 Called by the GraphicsEngine when the window is about to change to another DisplayRegion. More...
 
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). More...
 
void clear_child_sort ()
 Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value. More...
 
void clear_delete_flag ()
 Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning of the next frame. More...
 
virtual void clear_pipe ()
 Sets the window's _pipe pointer to NULL; this is generally called only as a precursor to deleting the window. More...
 
void clear_render_textures ()
 If the GraphicsOutput is currently rendering to a texture, then all textures are dissociated from the GraphicsOuput. More...
 
int count_textures () const
 If the GraphicsOutput is set to render into a texture, returns the number of textures that are being rendered into. More...
 
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. More...
 
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. More...
 
virtual bool flip_ready () const
 Returns true if a frame has been rendered and needs to be flipped, false otherwise. More...
 
virtual TypeHandle force_init_type ()
 
int get_child_sort () const
 Returns the sort value of future offscreen buffers created by make_texture_sort(). More...
 
PStatCollectorget_cull_window_pcollector ()
 Returns a PStatCollector for timing the cull operation for just this GraphicsOutput. More...
 
bool get_delete_flag () const
 Returns the current setting of the delete flag. More...
 
PStatCollectorget_draw_window_pcollector ()
 Returns a PStatCollector for timing the draw operation for just this GraphicsOutput. More...
 
GraphicsEngineget_engine () const
 Returns the graphics engine that created this output. More...
 
const FrameBufferPropertiesget_fb_properties () const
 Returns the framebuffer properties of the window. More...
 
LVecBase2i get_fb_size () const
 Returns the internal size of the window or buffer. More...
 
int get_fb_x_size () const
 Returns the internal width of the window or buffer. More...
 
int get_fb_y_size () const
 Returns the internal height of the window or buffer. More...
 
GraphicsStateGuardianget_gsg () const
 Returns the GSG that is associated with this window. More...
 
virtual GraphicsOutputget_host ()
 This is normally called only from within make_texture_buffer(). More...
 
bool get_inverted () const
 Returns the current setting of the inverted flag. More...
 
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. More...
 
const string & get_name () const
 Returns the name that was passed to the GraphicsOutput constructor. More...
 
int get_num_active_display_regions () const
 Returns the number of active DisplayRegions that have been created within the window. More...
 
int get_num_display_regions () const
 Returns the number of DisplayRegions that have been created within the window, active or otherwise. More...
 
bool get_one_shot () const
 Returns the current setting of the one-shot flag. More...
 
DisplayRegionget_overlay_display_region () const
 Returns the special "overlay" DisplayRegion that is created for each window or buffer. More...
 
GraphicsPipeget_pipe () const
 Returns the GraphicsPipe that this window is associated with. More...
 
bool get_red_blue_stereo () const
 Returns whether red-blue stereo mode is in effect for this particular window. More...
 
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. More...
 
RenderTextureMode get_rtm_mode (int i=0) const
 Returns the RenderTextureMode associated with the nth render-texture. More...
 
const LVecBase4get_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. More...
 
LVecBase2i get_sbs_left_size () const
 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 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(). More...
 
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(). More...
 
const LVecBase4get_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. More...
 
LVecBase2i get_sbs_right_size () const
 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 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(). More...
 
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(). More...
 
bool get_screenshot (PNMImage &image)
 Captures the most-recently rendered image from the framebuffer into the indicated PNMImage. More...
 
bool get_side_by_side_stereo () const
 Returns whether side-by-side stereo mode is in effect for this particular window. More...
 
const LVecBase2iget_size () const
 Returns the visible size of the window or buffer, if it is known. More...
 
int get_sort () const
 Returns the sorting order of this particular GraphicsOutput. More...
 
virtual bool get_supports_render_texture () const
 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 get_swap_eyes () const
 Returns the current setting of the "swap eyes" flag. More...
 
virtual Textureget_texture (int i=0) const
 Returns the nth texture into which the GraphicsOutput renders. More...
 
NodePath get_texture_card ()
 Returns a PandaNode containing a square polygon. More...
 
RenderTexturePlane get_texture_plane (int i=0) const
 Returns the RenderTexturePlane associated with the nth render-texture. More...
 
virtual TypeHandle get_type () const
 
int get_x_size () const
 Returns the visible width of the window or buffer, if it is known. More...
 
int get_y_size () const
 Returns the visible height of the window or buffer, if it is known. More...
 
bool has_size () const
 Returns true if the size of the window/frame buffer is known, false otherwise. More...
 
bool has_texture () const
 Returns true if the GraphicsOutput is rendering into any textures at all. More...
 
virtual bool is_active () const
 Returns true if the window is ready to be rendered into, false otherwise. More...
 
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). More...
 
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. More...
 
bool is_valid () const
 Returns true if the output is fully created and ready for rendering, false otherwise. More...
 
GraphicsOutputmake_cube_map (const string &name, int size, NodePath &camera_rig, DrawMask camera_mask=PandaNode::get_all_camera_mask(), bool to_ram=false, FrameBufferProperties *fbp=NULL)
 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...
 
DisplayRegionmake_display_region ()
 Creates a new DisplayRegion that covers the entire window. More...
 
DisplayRegionmake_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. More...
 
DisplayRegionmake_display_region (const LVecBase4 &dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
DisplayRegionmake_mono_display_region ()
 Creates a new DisplayRegion that covers the entire window. More...
 
DisplayRegionmake_mono_display_region (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
 Creates a new DisplayRegion that covers the entire window. More...
 
DisplayRegionmake_mono_display_region (const LVecBase4 &dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
 MAKE_SEQ (get_display_regions, get_num_display_regions, get_display_region)
 
 MAKE_SEQ (get_active_display_regions, get_num_active_display_regions, get_active_display_region)
 
StereoDisplayRegionmake_stereo_display_region ()
 Creates a new DisplayRegion that covers the entire window. More...
 
StereoDisplayRegionmake_stereo_display_region (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
 Creates a new DisplayRegion that covers the entire window. More...
 
StereoDisplayRegionmake_stereo_display_region (const LVecBase4 &dimensions)
 Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. More...
 
GraphicsOutputmake_texture_buffer (const string &name, int x_size, int y_size, Texture *tex=NULL, bool to_ram=false, FrameBufferProperties *fbp=NULL)
 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...
 
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. More...
 
virtual void process_events ()
 Do whatever processing in the window thread is appropriate for this output object each frame. More...
 
 PT (DisplayRegion) get_display_region(int n) const
 
 PT (DisplayRegion) get_active_display_region(int n) const
 
 PT (Texture) get_screenshot()
 
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. More...
 
void remove_all_display_regions ()
 Removes all display regions from the window, except the default one that is created with the window. More...
 
bool remove_display_region (DisplayRegion *display_region)
 Removes the indicated DisplayRegion from the window, and destructs it if there are no other references. More...
 
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(). More...
 
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(). More...
 
virtual void reset_window (bool swapchain)
 Resets the window framebuffer from its derived children. More...
 
bool save_screenshot (const Filename &filename, const string &image_comment="")
 Saves a screenshot of the region to the indicated filename. More...
 
Filename save_screenshot_default (const string &prefix="screenshot")
 Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed. More...
 
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. More...
 
void set_active (bool active)
 Sets the active flag associated with the GraphicsOutput. More...
 
void set_child_sort (int child_sort)
 Specifies the sort value of future offscreen buffers created by make_texture_sort(). More...
 
virtual void set_close_now ()
 This is called by the GraphicsEngine to insist that the output be closed immediately. More...
 
void set_inverted (bool inverted)
 Changes the current setting of the inverted flag. More...
 
void set_one_shot (bool one_shot)
 Changes the current setting of the one-shot flag. More...
 
void set_overlay_display_region (DisplayRegion *display_region)
 Replaces the special "overlay" DisplayRegion that is created for each window or buffer. More...
 
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. More...
 
void set_side_by_side_stereo (bool side_by_side_stereo)
 Enables side-by-side stereo mode on this particular window. More...
 
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. More...
 
void set_size_and_recalc (int x, int y)
 Changes the x_size and y_size, then recalculates structures that depend on size. More...
 
virtual void set_sort (int sort)
 Adjusts the sorting order of this particular GraphicsOutput, relative to other GraphicsOutputs. More...
 
void set_swap_eyes (bool swap_eyes)
 Changes the "swap eyes" flag. More...
 
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. More...
 
virtual bool share_depth_buffer (GraphicsOutput *graphics_output)
 Will attempt to use the depth buffer of the input graphics_output. More...
 
void trigger_copy ()
 When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the next frame). More...
 
virtual void unshare_depth_buffer ()
 Discontinue sharing the depth buffer. More...
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
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(). More...
 
string encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. More...
 
bool encode_to_bam_stream (string &data, BamWriter *writer=NULL) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
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. More...
 
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. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
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. More...
 
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. More...
 
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
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. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
void operator= (const TypedObject &copy)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 Returns the current reference count. More...
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 
- 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. More...
 
virtual void disable_clears ()
 Disables both the color and depth clear. More...
 
virtual bool get_clear_active (int n) const
 Gets the clear-active flag for any bitplane. More...
 
const LColorget_clear_color () const
 Returns the current clear color value. More...
 
bool get_clear_color_active () const
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
PN_stdfloat get_clear_depth () const
 Returns the current clear depth value. More...
 
bool get_clear_depth_active () const
 Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. More...
 
unsigned int get_clear_stencil () const
 Returns the current clear stencil value. More...
 
bool get_clear_stencil_active () const
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
virtual const LColorget_clear_value (int n) const
 Returns the clear value for any bitplane. More...
 
int get_draw_buffer_type () const
 Returns the RenderBuffer into which the GSG should issue draw commands. More...
 
PN_stdfloat get_pixel_factor () const
 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...
 
PN_stdfloat get_pixel_zoom () const
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More...
 
int get_screenshot_buffer_type () const
 Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion. More...
 
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. More...
 
void operator= (const DrawableRegion &copy)
 
virtual void set_clear_active (int n, bool clear_aux_active)
 Sets the clear-active flag for any bitplane. More...
 
void set_clear_color (const LColor &color)
 Sets the clear color to the indicated value. More...
 
void set_clear_color_active (bool clear_color_active)
 Toggles the flag that indicates whether the color buffer should be cleared every frame. More...
 
void set_clear_depth (PN_stdfloat depth)
 Sets the clear depth to the indicated value. More...
 
void set_clear_depth_active (bool clear_depth_active)
 Toggles the flag that indicates whether the depth buffer should be cleared every frame. More...
 
void set_clear_stencil (unsigned int stencil)
 Sets the clear stencil to the indicated value. More...
 
void set_clear_stencil_active (bool clear_stencil_active)
 Toggles the flag that indicates whether the stencil buffer should be cleared every frame. More...
 
virtual void set_clear_value (int n, const LColor &clear_value)
 Sets the clear value for any bitplane. More...
 
virtual void set_pixel_zoom (PN_stdfloat pixel_zoom)
 Sets the amount by which the pixels of the region are scaled internally when filling the image interally. More...
 
virtual bool supports_pixel_zoom () const
 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 get_class_type ()
 
static void init_type ()
 
static Filename make_screenshot_filename (const string &prefix="screenshot")
 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 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(const string &data
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. More...
 
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. More...
 
- 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. More...
 

Friends

class DisplayRegion
 
class GraphicsEngine
 
class GraphicsPipe
 

Additional Inherited Members

- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = NULL)
 
- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = (TypedWritable*)0L
 

Detailed Description

This is a base class for the various different classes that represent the result of a frame of rendering.

The most common kind of GraphicsOutput is a GraphicsWindow, which is a real-time window on the desktop, but another example is GraphicsBuffer, which is an offscreen buffer.

The actual rendering, and anything associated with the graphics context itself, is managed by the associated GraphicsStateGuardian (which might output to multiple GraphicsOutput objects).

GraphicsOutputs are not actually writable to bam files, of course, but they may be passed as event parameters, so they inherit from TypedWritableReferenceCount instead of TypedReferenceCount for that convenience.

Definition at line 68 of file graphicsOutput.h.

Member Function Documentation

void GraphicsOutput::add_render_texture ( Texture tex,
RenderTextureMode  mode,
RenderTexturePlane  plane = 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.

If tex is not NULL, it is the texture that will be set up for rendering into; otherwise, a new Texture object will be created, in which case you may call get_texture() to retrieve the new texture pointer.

You can specify a bitplane to attach the texture to. the legal choices are:

RTP_depth RTP_depth_stencil RTP_color RTP_aux_rgba_0 RTP_aux_rgba_1 RTP_aux_rgba_2 RTP_aux_rgba_3

If you do not specify a bitplane to attach the texture to, this routine will use a default based on the texture's format:

F_depth_component attaches to RTP_depth F_depth_stencil attaches to RTP_depth_stencil all other formats attach to RTP_color.

The texture's format will be changed to match the format of the bitplane to which it is attached. For example, if you pass in an F_rgba texture and order that it be attached to RTP_depth_stencil, it will turn into an F_depth_stencil texture.

Also see make_texture_buffer(), which is a higher-level interface for preparing render-to-a-texture mode.

Definition at line 277 of file graphicsOutput.cxx.

References Texture::clear_ram_image(), Texture::get_format(), get_name(), Texture::get_num_views(), get_supports_render_texture(), get_x_size(), get_y_size(), Texture::get_z_size(), Texture::set_component_type(), Texture::set_compression(), Texture::set_format(), Texture::set_match_framebuffer_format(), Texture::set_num_views(), Texture::set_render_to_texture(), Texture::set_size_padded(), Texture::set_wrap_u(), and Texture::set_wrap_v().

Referenced by make_texture_buffer(), and setup_render_texture().

void GraphicsOutput::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 in CallbackGraphicsWindow, WinGraphicsWindow, ParasiteBuffer, osxGraphicsWindow, IPhoneGraphicsWindow, and wglGraphicsWindow.

Definition at line 1424 of file graphicsOutput.cxx.

Referenced by CallbackGraphicsWindow::begin_flip().

bool GraphicsOutput::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 in CallbackGraphicsWindow, ParasiteBuffer, wglGraphicsBuffer, AndroidGraphicsWindow, wdxGraphicsBuffer9, osxGraphicsWindow, x11GraphicsWindow, CocoaGraphicsWindow, wdxGraphicsWindow9, eglGraphicsWindow, glxGraphicsPixmap, IPhoneGraphicsWindow, eglGraphicsPixmap, glxGraphicsWindow, osxGraphicsBuffer, eglGraphicsBuffer, glxGraphicsBuffer, TinyGraphicsBuffer, and wglGraphicsWindow.

Definition at line 1300 of file graphicsOutput.cxx.

Referenced by CallbackGraphicsWindow::begin_frame().

void GraphicsOutput::change_scenes ( DisplayRegionPipelineReader new_dr)

Called by the GraphicsEngine when the window is about to change to another DisplayRegion.

This exists mainly to provide a callback for switching the cube map face, if we are rendering to the different faces of a cube map.

Definition at line 1325 of file graphicsOutput.cxx.

References DrawableRegion::get_draw_buffer_type(), get_fb_properties(), get_name(), DisplayRegionPipelineReader::get_target_tex_page(), and select_target_tex_page().

void GraphicsOutput::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).

This function is called only within the draw thread.

Definition at line 1274 of file graphicsOutput.cxx.

References get_name(), and DrawableRegion::is_any_clear_active().

void GraphicsOutput::clear_child_sort ( )
inline

Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value.

See set_child_sort().

Definition at line 607 of file graphicsOutput.I.

void GraphicsOutput::clear_delete_flag ( )
inline

Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning of the next frame.

Definition at line 557 of file graphicsOutput.I.

void GraphicsOutput::clear_pipe ( )
virtual

Sets the window's _pipe pointer to NULL; this is generally called only as a precursor to deleting the window.

Reimplemented in IPhoneGraphicsWindow.

Definition at line 1228 of file graphicsOutput.cxx.

void GraphicsOutput::clear_render_textures ( )

If the GraphicsOutput is currently rendering to a texture, then all textures are dissociated from the GraphicsOuput.

Definition at line 228 of file graphicsOutput.cxx.

Referenced by setup_render_texture().

int GraphicsOutput::count_textures ( ) const
inline

If the GraphicsOutput is set to render into a texture, returns the number of textures that are being rendered into.

Normally, the textures would be associated with different buffers - a color texture, a depth texture, and a stencil texture.

Definition at line 82 of file graphicsOutput.I.

Referenced by wdxGraphicsBuffer9::select_target_tex_page().

void GraphicsOutput::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 in CallbackGraphicsWindow, ParasiteBuffer, AndroidGraphicsWindow, osxGraphicsWindow, CocoaGraphicsWindow, IPhoneGraphicsWindow, wdxGraphicsWindow9, eglGraphicsWindow, glxGraphicsWindow, and wglGraphicsWindow.

Definition at line 1453 of file graphicsOutput.cxx.

Referenced by glxGraphicsWindow::end_flip(), wglGraphicsWindow::end_flip(), eglGraphicsWindow::end_flip(), wdxGraphicsWindow9::end_flip(), AndroidGraphicsWindow::end_flip(), and CallbackGraphicsWindow::end_flip().

void GraphicsOutput::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 in CallbackGraphicsWindow, ParasiteBuffer, wglGraphicsBuffer, AndroidGraphicsWindow, wdxGraphicsBuffer9, osxGraphicsWindow, x11GraphicsWindow, CocoaGraphicsWindow, wdxGraphicsWindow9, eglGraphicsWindow, glxGraphicsPixmap, IPhoneGraphicsWindow, eglGraphicsPixmap, osxGraphicsBuffer, eglGraphicsBuffer, glxGraphicsBuffer, TinyGraphicsBuffer, and wglGraphicsWindow.

Definition at line 1312 of file graphicsOutput.cxx.

Referenced by CallbackGraphicsWindow::end_frame().

bool GraphicsOutput::flip_ready ( ) const
virtual

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

Reimplemented in ParasiteBuffer.

Definition at line 1154 of file graphicsOutput.cxx.

int GraphicsOutput::get_child_sort ( ) const
inline

Returns the sort value of future offscreen buffers created by make_texture_sort().

See set_child_sort().

Definition at line 618 of file graphicsOutput.I.

References get_sort().

Referenced by make_texture_buffer().

PStatCollector & GraphicsOutput::get_cull_window_pcollector ( )
inline

Returns a PStatCollector for timing the cull operation for just this GraphicsOutput.

Definition at line 886 of file graphicsOutput.I.

bool GraphicsOutput::get_delete_flag ( ) const

Returns the current setting of the delete flag.

When this is true, the GraphicsOutput will automatically be removed before the beginning of the next frame by the GraphicsEngine.

Definition at line 606 of file graphicsOutput.cxx.

Referenced by GraphicsEngine::render_frame().

PStatCollector & GraphicsOutput::get_draw_window_pcollector ( )
inline

Returns a PStatCollector for timing the draw operation for just this GraphicsOutput.

Definition at line 897 of file graphicsOutput.I.

GraphicsEngine * GraphicsOutput::get_engine ( ) const
inline

Returns the graphics engine that created this output.

Since there is normally only one GraphicsEngine object in an application, this is usually the same as the global GraphicsEngine.

Definition at line 57 of file graphicsOutput.I.

Referenced by GraphicsEngine::add_window().

const FrameBufferProperties & GraphicsOutput::get_fb_properties ( ) const
inline
LVecBase2i GraphicsOutput::get_fb_size ( ) const
inline

Returns the internal size of the window or buffer.

This is almost always the same as get_size(), except when a pixel_zoom is in effect–see set_pixel_zoom().

Definition at line 219 of file graphicsOutput.I.

References DrawableRegion::get_pixel_factor().

int GraphicsOutput::get_fb_x_size ( ) const
inline

Returns the internal width of the window or buffer.

This is almost always the same as get_x_size(), except when a pixel_zoom is in effect–see set_pixel_zoom().

Definition at line 233 of file graphicsOutput.I.

References DrawableRegion::get_pixel_factor().

Referenced by DisplayRegion::compute_pixels(), DisplayRegion::compute_pixels_all_stages(), DisplayRegion::set_dimensions(), and set_size_and_recalc().

int GraphicsOutput::get_fb_y_size ( ) const
inline

Returns the internal height of the window or buffer.

This is almost always the same as get_y_size(), except when a pixel_zoom is in effect–see set_pixel_zoom().

Definition at line 246 of file graphicsOutput.I.

References DrawableRegion::get_pixel_factor().

Referenced by DisplayRegion::compute_pixels(), DisplayRegion::compute_pixels_all_stages(), DisplayRegion::set_dimensions(), and set_size_and_recalc().

GraphicsStateGuardian * GraphicsOutput::get_gsg ( ) const
inline

Returns the GSG that is associated with this window.

There is a one-to-one association between windows and GSG's.

This may return NULL if the graphics context has not yet been created for the window, e.g. before the first frame has rendered; or after the window has been closed.

Definition at line 29 of file graphicsOutput.I.

Referenced by NonlinearImager::add_viewer(), GraphicsEngine::add_window(), GraphicsEngine::make_buffer(), make_cube_map(), GraphicsEngine::make_output(), GraphicsEngine::make_parasite(), make_texture_buffer(), ParasiteBuffer::ParasiteBuffer(), GraphicsEngine::remove_all_windows(), GraphicsEngine::remove_window(), DisplayRegionCullCallbackData::upcall(), and DisplayRegionDrawCallbackData::upcall().

GraphicsOutput * GraphicsOutput::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 in ParasiteBuffer.

Definition at line 1168 of file graphicsOutput.cxx.

Referenced by GraphicsEngine::make_output(), and make_texture_buffer().

bool GraphicsOutput::get_inverted ( ) const
inline

Returns the current setting of the inverted flag.

When this is true, the scene is rendered into the window upside-down, flipped like a mirror along the X axis. See set_inverted().

Definition at line 390 of file graphicsOutput.I.

unsigned int GraphicsOutput::get_left_eye_color_mask ( ) const
inline

Returns the color mask in effect when rendering a left-eye view in red_blue stereo mode.

This is one or more bits defined in ColorWriteAttrib::Channels. See set_red_blue_stereo().

Definition at line 472 of file graphicsOutput.I.

Referenced by GraphicsStateGuardian::prepare_display_region().

const string & GraphicsOutput::get_name ( ) const
inline

Returns the name that was passed to the GraphicsOutput constructor.

Definition at line 68 of file graphicsOutput.I.

Referenced by add_render_texture(), change_scenes(), clear(), and ParasiteBuffer::ParasiteBuffer().

int GraphicsOutput::get_num_active_display_regions ( ) const

Returns the number of active DisplayRegions that have been created within the window.

Definition at line 875 of file graphicsOutput.cxx.

Referenced by GraphicsEngine::render_frame().

int GraphicsOutput::get_num_display_regions ( ) const

Returns the number of DisplayRegions that have been created within the window, active or otherwise.

Definition at line 834 of file graphicsOutput.cxx.

bool GraphicsOutput::get_one_shot ( ) const

Returns the current setting of the one-shot flag.

When this is true, the GraphicsOutput will automatically set itself inactive after the next frame.

Definition at line 500 of file graphicsOutput.cxx.

References ClockObject::get_frame_count(), and ClockObject::get_global_clock().

DisplayRegion * GraphicsOutput::get_overlay_display_region ( ) const
inline

Returns the special "overlay" DisplayRegion that is created for each window or buffer.

This DisplayRegion covers the entire window, but cannot be used for rendering. It is a placeholder only, to indicate the dimensions of the window, and is usually used internally for purposes such as clearing the window, or grabbing a screenshot of the window.

There are very few applications that require access to this DisplayRegion. Normally, you should create your own DisplayRegion that covers the window, if you want to render to the window.

Definition at line 756 of file graphicsOutput.I.

GraphicsPipe * GraphicsOutput::get_pipe ( ) const
inline

Returns the GraphicsPipe that this window is associated with.

It is possible that the GraphicsPipe might have been deleted while an outstanding PT(GraphicsOutput) prevented all of its children windows from also being deleted; in this unlikely case, get_pipe() may return NULL.

Definition at line 44 of file graphicsOutput.I.

Referenced by GraphicsEngine::add_window(), DisplayRegion::get_pipe(), DisplayRegionPipelineReader::get_pipe(), GraphicsEngine::make_buffer(), GraphicsEngine::make_parasite(), and make_texture_buffer().

bool GraphicsOutput::get_red_blue_stereo ( ) const
inline

Returns whether red-blue stereo mode is in effect for this particular window.

See set_red_blue_stereo().

Definition at line 459 of file graphicsOutput.I.

unsigned int GraphicsOutput::get_right_eye_color_mask ( ) const
inline

Returns the color mask in effect when rendering a right-eye view in red_blue stereo mode.

This is one or more bits defined in ColorWriteAttrib::Channels. See set_red_blue_stereo().

Definition at line 485 of file graphicsOutput.I.

Referenced by GraphicsStateGuardian::prepare_display_region().

GraphicsOutput::RenderTextureMode GraphicsOutput::get_rtm_mode ( int  i = 0) const
inline

Returns the RenderTextureMode associated with the nth render-texture.

Returns RTM_none if there is no such texture.

Definition at line 145 of file graphicsOutput.I.

const LVecBase4 & GraphicsOutput::get_sbs_left_dimensions ( ) const
inline

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.

See set_side_by_side_stereo().

Definition at line 509 of file graphicsOutput.I.

LVecBase2i GraphicsOutput::get_sbs_left_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_size().

Definition at line 260 of file graphicsOutput.I.

int GraphicsOutput::get_sbs_left_x_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_x_size().

Definition at line 277 of file graphicsOutput.I.

int GraphicsOutput::get_sbs_left_y_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_y_size().

Definition at line 292 of file graphicsOutput.I.

const LVecBase4 & GraphicsOutput::get_sbs_right_dimensions ( ) const
inline

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.

See set_side_by_side_stereo().

Definition at line 522 of file graphicsOutput.I.

LVecBase2i GraphicsOutput::get_sbs_right_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_size().

Definition at line 307 of file graphicsOutput.I.

int GraphicsOutput::get_sbs_right_x_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_x_size().

Definition at line 324 of file graphicsOutput.I.

int GraphicsOutput::get_sbs_right_y_size ( ) const
inline

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().

If side-by-side stereo is not enabled, this returns the same as get_y_size().

Definition at line 339 of file graphicsOutput.I.

bool GraphicsOutput::get_screenshot ( PNMImage image)
inline

Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.

Returns true on success, false on failure.

Definition at line 816 of file graphicsOutput.I.

bool GraphicsOutput::get_side_by_side_stereo ( ) const
inline

Returns whether side-by-side stereo mode is in effect for this particular window.

See set_side_by_side_stereo().

Definition at line 496 of file graphicsOutput.I.

const LVecBase2i & GraphicsOutput::get_size ( ) const
inline

Returns the visible size of the window or buffer, if it is known.

In certain cases (e.g. fullscreen windows), the size may not be known until after the object has been fully created. Check has_size() first.

Certain objects (like windows) may change size spontaneously; this method is not thread-safe. To get the size of a window in a thread-safe manner, query get_properties().

Definition at line 168 of file graphicsOutput.I.

Referenced by ParasiteBuffer::ParasiteBuffer().

int GraphicsOutput::get_sort ( ) const
inline

Returns the sorting order of this particular GraphicsOutput.

The various GraphicsOutputs within a particular thread will be rendered in the indicated order.

Definition at line 570 of file graphicsOutput.I.

Referenced by get_child_sort().

bool GraphicsOutput::get_supports_render_texture ( ) const
virtual

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.

Reimplemented in wglGraphicsBuffer, and wdxGraphicsBuffer9.

Definition at line 1143 of file graphicsOutput.cxx.

Referenced by add_render_texture().

bool GraphicsOutput::get_swap_eyes ( ) const
inline

Returns the current setting of the "swap eyes" flag.

See set_swap_eyes().

Definition at line 417 of file graphicsOutput.I.

Referenced by GraphicsStateGuardian::prepare_display_region().

Texture * GraphicsOutput::get_texture ( int  i = 0) const
inlinevirtual

Returns the nth texture into which the GraphicsOutput renders.

Returns NULL if there is no such texture.

If the texture is non-NULL, it may be applied to geometry to be rendered for any other windows or outputs that share the same GSG as this GraphicsOutput. The effect is undefined for windows that share a different GSG; usually in these cases the texture will be invalid.

Implements GraphicsOutputBase.

Definition at line 113 of file graphicsOutput.I.

Referenced by MultitexReducer::flatten(), and wdxGraphicsBuffer9::select_target_tex_page().

NodePath GraphicsOutput::get_texture_card ( )

Returns a PandaNode containing a square polygon.

The dimensions are (-1,0,-1) to (1,0,1). The texture coordinates are such that the texture of this GraphicsOutput is aligned properly to the polygon. The GraphicsOutput promises to surgically update the Geom inside the PandaNode if necessary to maintain this invariant.

Each invocation of this function returns a freshly- allocated PandaNode. You can therefore safely modify the RenderAttribs of the PandaNode. The PandaNode is initially textured with the texture of this GraphicOutput.

Definition at line 1080 of file graphicsOutput.cxx.

References PandaNode::add_child(), Texture::get_format(), get_x_size(), get_y_size(), NodePath::node(), and NodePath::set_texture().

GraphicsOutput::RenderTexturePlane GraphicsOutput::get_texture_plane ( int  i = 0) const
inline

Returns the RenderTexturePlane associated with the nth render-texture.

Returns 0 if there is no such texture.

Definition at line 129 of file graphicsOutput.I.

Referenced by wdxGraphicsBuffer9::select_target_tex_page().

int GraphicsOutput::get_x_size ( ) const
inline

Returns the visible width of the window or buffer, if it is known.

In certain cases (e.g. fullscreen windows), the size may not be known until after the object has been fully created. Check has_size() first.

Certain objects (like windows) may change size spontaneously; this method is not thread-safe. To get the size of a window in a thread-safe manner, query get_properties().

Definition at line 187 of file graphicsOutput.I.

Referenced by add_render_texture(), ParasiteBuffer::begin_frame(), get_texture_card(), set_inverted(), GraphicsWindowInputDevice::set_pointer(), and wdxGraphicsBuffer9::share_depth_buffer().

int GraphicsOutput::get_y_size ( ) const
inline

Returns the visible height of the window or buffer, if it is known.

In certain cases (e.g. fullscreen windows), the size may not be known until after the object has been fully created. Check has_size() first.

Certain objects (like windows) may change size spontaneously; this method is not thread-safe. To get the size of a window in a thread-safe manner, query get_properties().

Definition at line 206 of file graphicsOutput.I.

Referenced by add_render_texture(), ParasiteBuffer::begin_frame(), get_texture_card(), set_inverted(), GraphicsWindowInputDevice::set_pointer(), and wdxGraphicsBuffer9::share_depth_buffer().

bool GraphicsOutput::has_size ( ) const
inline

Returns true if the size of the window/frame buffer is known, false otherwise.

In certain cases the size may not be known until after the object has been fully created. Also, certain objects (like windows) may change size spontaneously.

Definition at line 354 of file graphicsOutput.I.

Referenced by DisplayRegion::set_dimensions().

bool GraphicsOutput::has_texture ( ) const
inline

Returns true if the GraphicsOutput is rendering into any textures at all.

Definition at line 94 of file graphicsOutput.I.

bool GraphicsOutput::is_active ( ) const
virtual

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

Reimplemented in GraphicsWindow, and ParasiteBuffer.

Definition at line 444 of file graphicsOutput.cxx.

References ClockObject::get_frame_count(), ClockObject::get_global_clock(), and is_valid().

Referenced by ParasiteBuffer::is_active(), and GraphicsWindow::is_active().

bool GraphicsOutput::is_nonzero_size ( ) const
inline

Returns true if the output has a nonzero size in both X and Y, or false if it is zero (and therefore invalid).

Definition at line 377 of file graphicsOutput.I.

bool GraphicsOutput::is_stereo ( ) const
inline

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.

Definition at line 545 of file graphicsOutput.I.

Referenced by make_display_region().

bool GraphicsOutput::is_valid ( ) const
inline

Returns true if the output is fully created and ready for rendering, false otherwise.

Definition at line 365 of file graphicsOutput.I.

Referenced by GraphicsEngine::add_window(), PandaFramework::all_windows_closed(), PandaFramework::event_window_event(), is_active(), GraphicsEngine::make_output(), and PandaFramework::open_window().

GraphicsOutput * GraphicsOutput::make_cube_map ( const string &  name,
int  size,
NodePath camera_rig,
DrawMask  camera_mask = PandaNode::get_all_camera_mask(),
bool  to_ram = false,
FrameBufferProperties fbp = NULL 
)

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.

The buffer is automatically set up with six display regions and six cameras, each of which are assigned the indicated draw_mask and parented to the given camera_rig node (which you should then put in your scene to render the cube map from the appropriate point of view).

You may take the texture associated with the buffer and apply it to geometry, particularly with TexGenAttrib::M_world_cube_map also in effect, to apply a reflection of everything seen by the camera rig.

Definition at line 1002 of file graphicsOutput.cxx.

References NodePath::attach_new_node(), DrawableRegion::copy_clear_settings(), get_gsg(), GraphicsStateGuardian::get_max_cube_map_dimension(), GraphicsStateGuardian::get_supports_cube_map(), NodePath::look_at(), make_display_region(), make_texture_buffer(), NodePath::node(), DisplayRegion::set_camera(), DrawableRegion::set_clear_color_active(), DrawableRegion::set_clear_depth_active(), DrawableRegion::set_clear_stencil_active(), PandaNode::set_effect(), and DisplayRegion::set_target_tex_page().

DisplayRegion * GraphicsOutput::make_display_region ( )
inline

Creates a new DisplayRegion that covers the entire window.

If is_stereo() is true for this window, and default-stereo-camera is configured true, this actually makes a StereoDisplayRegion. Call make_mono_display_region() or make_stereo_display_region() if you want to insist on one or the other.

Definition at line 652 of file graphicsOutput.I.

Referenced by MultitexReducer::flatten(), make_cube_map(), and make_display_region().

DisplayRegion * GraphicsOutput::make_display_region ( PN_stdfloat  l,
PN_stdfloat  r,
PN_stdfloat  b,
PN_stdfloat  t 
)
inline

Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.

The range on all parameters is 0..1.

If is_stereo() is true for this window, and default-stereo-camera is configured true, this actually makes a StereoDisplayRegion. Call make_mono_display_region() or make_stereo_display_region() if you want to insist on one or the other.

Definition at line 671 of file graphicsOutput.I.

References make_display_region().

DisplayRegion * GraphicsOutput::make_display_region ( const LVecBase4 dimensions)

Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.

The range on all parameters is 0..1.

If is_stereo() is true for this window, and default-stereo-camera is configured true, this actually makes a StereoDisplayRegion. Call make_mono_display_region() or make_stereo_display_region() if you want to insist on one or the other.

Definition at line 649 of file graphicsOutput.cxx.

References is_stereo(), make_mono_display_region(), and make_stereo_display_region().

DisplayRegion * GraphicsOutput::make_mono_display_region ( )
inline

Creates a new DisplayRegion that covers the entire window.

This generally returns a mono DisplayRegion, even if is_stereo() is true. However, if side-by-side stereo is enabled, this will return a StereoDisplayRegion whose two eyes are both set to SC_mono. (This is necessary because in side-by-side stereo mode, it is necessary to draw even mono DisplayRegions twice).

Definition at line 689 of file graphicsOutput.I.

Referenced by make_display_region(), and make_mono_display_region().

DisplayRegion * GraphicsOutput::make_mono_display_region ( PN_stdfloat  l,
PN_stdfloat  r,
PN_stdfloat  b,
PN_stdfloat  t 
)
inline

Creates a new DisplayRegion that covers the entire window.

This generally returns a mono DisplayRegion, even if is_stereo() is true. However, if side-by-side stereo is enabled, this will return a StereoDisplayRegion whose two eyes are both set to SC_mono. (This is necessary because in side-by-side stereo mode, it is necessary to draw even mono DisplayRegions twice).

Definition at line 707 of file graphicsOutput.I.

References make_mono_display_region().

DisplayRegion * GraphicsOutput::make_mono_display_region ( const LVecBase4 dimensions)

Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.

The range on all parameters is 0..1.

This generally returns a mono DisplayRegion, even if is_stereo() is true. However, if side-by-side stereo is enabled, this will return a StereoDisplayRegion whose two eyes are both set to SC_mono. (This is necessary because in side-by-side stereo mode, it is necessary to draw even mono DisplayRegions twice).

Definition at line 672 of file graphicsOutput.cxx.

References StereoDisplayRegion::get_left_eye(), StereoDisplayRegion::get_right_eye(), make_stereo_display_region(), and DisplayRegion::set_stereo_channel().

Filename GraphicsOutput::make_screenshot_filename ( const string &  prefix = "screenshot")
inlinestatic

Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed.

The default filename is generated from the supplied prefix and from the Config variable screenshot-filename, which contains the following strings:

%~p - the supplied prefix %~f - the frame count %~e - the value of screenshot-extension All other % strings in strftime().

Definition at line 776 of file graphicsOutput.I.

References DisplayRegion::make_screenshot_filename().

StereoDisplayRegion * GraphicsOutput::make_stereo_display_region ( )
inline

Creates a new DisplayRegion that covers the entire window.

This always returns a stereo DisplayRegion, even if is_stereo() is false.

Definition at line 721 of file graphicsOutput.I.

Referenced by make_display_region(), make_mono_display_region(), and make_stereo_display_region().

StereoDisplayRegion * GraphicsOutput::make_stereo_display_region ( PN_stdfloat  l,
PN_stdfloat  r,
PN_stdfloat  b,
PN_stdfloat  t 
)
inline

Creates a new DisplayRegion that covers the entire window.

This always returns a stereo DisplayRegion, even if is_stereo() is false.

Definition at line 735 of file graphicsOutput.I.

References make_stereo_display_region().

StereoDisplayRegion * GraphicsOutput::make_stereo_display_region ( const LVecBase4 dimensions)

Creates a new DisplayRegion that covers the indicated sub-rectangle within the window.

The range on all parameters is 0..1.

This always returns a stereo DisplayRegion, even if is_stereo() is false.

Definition at line 694 of file graphicsOutput.cxx.

References DrawableRegion::get_clear_depth_active(), and DrawableRegion::get_clear_stencil_active().

GraphicsOutput * GraphicsOutput::make_texture_buffer ( const string &  name,
int  x_size,
int  y_size,
Texture tex = NULL,
bool  to_ram = false,
FrameBufferProperties fbp = NULL 
)

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.

If tex is not NULL, it is the texture that will be set up for rendering into; otherwise, a new Texture object will be created. In either case, the target texture can be retrieved from the return value with buffer->get_texture() (assuming the return value is not NULL).

If to_ram is true, the buffer will be set up to download its contents to the system RAM memory associated with the Texture object, instead of keeping it strictly within texture memory; this is much slower, but it allows using the texture with any GSG.

This will attempt to be smart about maximizing render performance while minimizing framebuffer waste. It might return a GraphicsBuffer set to render directly into a texture, if possible; or it might return a ParasiteBuffer that renders into this window. The return value is NULL if the buffer could not be created for some reason.

When you are done using the buffer, you should remove it with a call to GraphicsEngine::remove_window().

Definition at line 935 of file graphicsOutput.cxx.

References add_render_texture(), get_child_sort(), GraphicsStateGuardian::get_engine(), get_gsg(), get_host(), get_pipe(), GraphicsStateGuardian::get_prepared_objects(), Texture::get_texture_type(), FrameBufferProperties::set_color_bits(), and WindowProperties::size().

Referenced by MultitexReducer::flatten(), and make_cube_map().

bool GraphicsOutput::operator< ( const GraphicsOutput other) const
inline

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.

Definition at line 841 of file graphicsOutput.I.

void GraphicsOutput::process_events ( )
virtual

Do whatever processing in the window thread is appropriate for this output object each frame.

This function is called only within the window thread.

Reimplemented in CallbackGraphicsWindow, GraphicsWindow, WinGraphicsWindow, wglGraphicsBuffer, GraphicsBuffer, AndroidGraphicsWindow, wdxGraphicsBuffer9, osxGraphicsWindow, CocoaGraphicsWindow, x11GraphicsWindow, eglGraphicsWindow, and IPhoneGraphicsWindow.

Definition at line 1467 of file graphicsOutput.cxx.

void GraphicsOutput::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 in ParasiteBuffer, and wglGraphicsWindow.

Definition at line 1439 of file graphicsOutput.cxx.

void GraphicsOutput::remove_all_display_regions ( )

Removes all display regions from the window, except the default one that is created with the window.

Definition at line 781 of file graphicsOutput.cxx.

References DisplayRegion::cleanup().

bool GraphicsOutput::remove_display_region ( DisplayRegion display_region)

Removes the indicated DisplayRegion from the window, and destructs it if there are no other references.

Returns true if the DisplayRegion is found and removed, false if it was not a part of the window.

Definition at line 759 of file graphicsOutput.cxx.

References StereoDisplayRegion::get_left_eye(), StereoDisplayRegion::get_right_eye(), and DisplayRegion::is_stereo().

void GraphicsOutput::request_close ( )
virtual

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().

By that time we promise the gsg pointer will be cleared.

Reimplemented in GraphicsWindow, and GraphicsBuffer.

Definition at line 1194 of file graphicsOutput.cxx.

void GraphicsOutput::request_open ( )
virtual

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().

Reimplemented in GraphicsWindow, and GraphicsBuffer.

Definition at line 1181 of file graphicsOutput.cxx.

void GraphicsOutput::reset_window ( bool  swapchain)
virtual

Resets the window framebuffer from its derived children.

Does nothing here.

Definition at line 1215 of file graphicsOutput.cxx.

Referenced by GraphicsEngine::reset_all_windows().

bool GraphicsOutput::save_screenshot ( const Filename filename,
const string &  image_comment = "" 
)
inline

Saves a screenshot of the region to the indicated filename.

The image comment is an optional user readable string that will be saved with the header of the image (if the file format supports embedded data; for example jpg allows comments). Returns true on success, false on failure.

Definition at line 804 of file graphicsOutput.I.

Filename GraphicsOutput::save_screenshot_default ( const string &  prefix = "screenshot")
inline

Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed.

The filename is generated by make_screenshot_filename().

Definition at line 789 of file graphicsOutput.I.

Referenced by PandaFramework::event_f9().

void GraphicsOutput::select_target_tex_page ( int  page)
virtual

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.

This should do whatever needs to be done to switch the buffer to the indicated page.

Reimplemented in wglGraphicsBuffer, and wdxGraphicsBuffer9.

Definition at line 1406 of file graphicsOutput.cxx.

Referenced by change_scenes().

void GraphicsOutput::set_active ( bool  active)

Sets the active flag associated with the GraphicsOutput.

If the GraphicsOutput is marked inactive, nothing is rendered.

Definition at line 429 of file graphicsOutput.cxx.

void GraphicsOutput::set_child_sort ( int  child_sort)
inline

Specifies the sort value of future offscreen buffers created by make_texture_sort().

The purpose of this method is to allow the user to limit the sort value chosen for a buffer created via make_texture_buffer(). Normally, this buffer will be assigned a value of get_sort() - 1, so that it will be rendered before this window is rendered; but sometimes this isn't sufficiently early, especially if other buffers also have a view into the same scene.

If you specify a value here, then new buffers created via make_texture_buffer() will be given that sort value instead of get_sort() - 1.

Definition at line 594 of file graphicsOutput.I.

void GraphicsOutput::set_close_now ( )
virtual

This is called by the GraphicsEngine to insist that the output be closed immediately.

This is only called from the window thread.

Reimplemented in GraphicsWindow, and GraphicsBuffer.

Definition at line 1205 of file graphicsOutput.cxx.

void GraphicsOutput::set_inverted ( bool  inverted)

Changes the current setting of the inverted flag.

When this is true, the scene is rendered into the window upside-down and backwards, that is, inverted as if viewed through a mirror placed on the floor.

This is primarily intended to support DirectX (and a few buggy OpenGL graphics drivers) that perform a framebuffer-to-texture copy upside-down from the usual OpenGL (and Panda) convention. Panda will automatically set this flag for offscreen buffers on hardware that is known to do this, to compensate when rendering offscreen into a texture.

Definition at line 522 of file graphicsOutput.cxx.

References get_x_size(), and get_y_size().

Referenced by ParasiteBuffer::ParasiteBuffer(), and GraphicsBuffer::process_events().

void GraphicsOutput::set_one_shot ( bool  one_shot)

Changes the current setting of the one-shot flag.

When this is true, the GraphicsOutput will render the current frame and then automatically set itself inactive. This is particularly useful for buffers that are created for the purposes of render-to-texture, for static textures that don't need to be continually re-rendered once they have been rendered the first time.

Setting the buffer inactive is not the same thing as destroying it. You are still responsible for passing this buffer to GraphicsEngine::remove_window() when you no longer need the texture, in order to clean up fully. (However, you should not call remove_window() on this buffer while the texture is still needed, because depending on the render-to-texture mechanism in use, this may invalidate the texture contents.)

Definition at line 482 of file graphicsOutput.cxx.

References ClockObject::get_frame_count(), and ClockObject::get_global_clock().

Referenced by MultitexReducer::flatten().

void GraphicsOutput::set_overlay_display_region ( DisplayRegion display_region)

Replaces the special "overlay" DisplayRegion that is created for each window or buffer.

See get_overlay_display_region(). This must be a new DisplayRegion that has already been created for this window, for instance via a call to make_mono_display_region(). You are responsible for ensuring that the new DisplayRegion covers the entire window. The previous overlay display region is not automatically removed; you must explicitly call remove_display_region() on it after replacing it with this method, if you wish it to be removed.

Normally, there is no reason to change the overlay DisplayRegion, so this method should be used only in very unusual circumstances.

Definition at line 822 of file graphicsOutput.cxx.

References DisplayRegion::get_window().

void GraphicsOutput::set_red_blue_stereo ( bool  red_blue_stereo,
unsigned int  left_eye_color_mask,
unsigned int  right_eye_color_mask 
)
inline

Enables red-blue stereo mode on this particular window.

When red-blue stereo mode is in effect, DisplayRegions that have the "left" channel set will render in the red (or specified) channel only, while DisplayRegions that have the "right" channel set will render in the blue (or specified) channel only.

The remaining two parameters specify the particular color channel(s) to associate with each eye. Use the bits defined in ColorWriteAttrib::Channels.

This can be used to achieve a cheesy stereo mode in the absence of hardware-supported stereo.

Definition at line 439 of file graphicsOutput.I.

void GraphicsOutput::set_side_by_side_stereo ( bool  side_by_side_stereo)

Enables side-by-side stereo mode on this particular window.

When side-by-side stereo mode is in effect, DisplayRegions that have the "left" channel set will render on the part of the window specified by sbs_left_dimensions (typically the left half: (0, 0.5, 0, 1)), while DisplayRegions that have the "right" channel set will render on the part of the window specified by sbs_right_dimensions (typically the right half: (0.5, 1, 0, 1)).

This is commonly used in a dual-monitor mode, where a window is opened that spans two monitors, and each monitor represents a different eye.

Definition at line 557 of file graphicsOutput.cxx.

void GraphicsOutput::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.

When side-by-side stereo mode is in effect, DisplayRegions that have the "left" channel set will render on the part of the window specified by sbs_left_dimensions (typically the left half: (0, 0.5, 0, 1)), while DisplayRegions that have the "right" channel set will render on the part of the window specified by sbs_right_dimensions (typically the right half: (0.5, 1, 0, 1)).

This is commonly used in a dual-monitor mode, where a window is opened that spans two monitors, and each monitor represents a different eye.

Definition at line 584 of file graphicsOutput.cxx.

void GraphicsOutput::set_size_and_recalc ( int  x,
int  y 
)

Changes the x_size and y_size, then recalculates structures that depend on size.

The recalculation currently includes:

  • compute_pixels on all the graphics regions.
  • updating the texture card, if one is present.

Definition at line 1242 of file graphicsOutput.cxx.

References get_fb_x_size(), and get_fb_y_size().

Referenced by GraphicsWindow::set_properties_now(), and GraphicsBuffer::set_size().

void GraphicsOutput::set_sort ( int  sort)
virtual

Adjusts the sorting order of this particular GraphicsOutput, relative to other GraphicsOutputs.

Implements GraphicsOutputBase.

Definition at line 625 of file graphicsOutput.cxx.

void GraphicsOutput::set_swap_eyes ( bool  swap_eyes)
inline

Changes the "swap eyes" flag.

This flag is normally false. When it is true, the left and right channels of a stereo DisplayRegion are sent to the opposite channels in the rendering backend. This is meant to work around hardware that inadvertently swaps the output channels, or hardware for which it cannot be determined which channel is which until runtime.

Definition at line 406 of file graphicsOutput.I.

void GraphicsOutput::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.

From now on, use clear_render_textures and add_render_texture instead.

Definition at line 408 of file graphicsOutput.cxx.

References add_render_texture(), and clear_render_textures().

bool GraphicsOutput::share_depth_buffer ( GraphicsOutput graphics_output)
virtual

Will attempt to use the depth buffer of the input graphics_output.

The buffer sizes must be exactly the same.

Reimplemented in wdxGraphicsBuffer9.

Definition at line 1121 of file graphicsOutput.cxx.

void GraphicsOutput::trigger_copy ( )
inline

When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the next frame).

Definition at line 634 of file graphicsOutput.I.

void GraphicsOutput::unshare_depth_buffer ( )
virtual

Discontinue sharing the depth buffer.

Reimplemented in wdxGraphicsBuffer9.

Definition at line 1131 of file graphicsOutput.cxx.


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