Panda3D
Loading...
Searching...
No Matches
graphicsOutput.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file graphicsOutput.I
10 * @author drose
11 * @date 2004-02-06
12 */
13
14/**
15 * Returns the GSG that is associated with this window. There is a one-to-one
16 * association between windows and GSG's.
17 *
18 * This may return NULL if the graphics context has not yet been created for
19 * the window, e.g. before the first frame has rendered; or after the window
20 * has been closed.
21 */
23get_gsg() const {
24 return _gsg;
25}
26
27/**
28 * Returns the GraphicsPipe that this window is associated with. It is
29 * possible that the GraphicsPipe might have been deleted while an outstanding
30 * PT(GraphicsOutput) prevented all of its children windows from also being
31 * deleted; in this unlikely case, get_pipe() may return NULL.
32 */
34get_pipe() const {
35 return _pipe;
36}
37
38/**
39 * Returns the graphics engine that created this output. Since there is
40 * normally only one GraphicsEngine object in an application, this is usually
41 * the same as the global GraphicsEngine.
42 */
44get_engine() const {
45 return _engine;
46}
47
48/**
49 * Returns the name that was passed to the GraphicsOutput constructor.
50 */
51INLINE const std::string &GraphicsOutput::
52get_name() const {
53 return _name;
54}
55
56/**
57 * If the GraphicsOutput is set to render into a texture, returns the number
58 * of textures that are being rendered into. Normally, the textures would be
59 * associated with different buffers - a color texture, a depth texture, and a
60 * stencil texture.
61 */
63count_textures() const {
64 CDReader cdata(_cycler);
65 return cdata->_textures.size();
66}
67
68/**
69 * Returns true if the GraphicsOutput is rendering into any textures at all.
70 */
72has_texture() const {
73 CDReader cdata(_cycler);
74 return (cdata->_textures.size() > 0);
75}
76
77/**
78 * Returns the nth texture into which the GraphicsOutput renders. Returns
79 * NULL if there is no such texture.
80 *
81 * If the texture is non-NULL, it may be applied to geometry to be rendered
82 * for any other windows or outputs that share the same GSG as this
83 * GraphicsOutput. The effect is undefined for windows that share a different
84 * GSG; usually in these cases the texture will be invalid.
85 */
87get_texture(int i) const {
88 CDReader cdata(_cycler);
89 if ((i < 0) || (i >= ((int)cdata->_textures.size()))) {
90 return nullptr;
91 }
92 return cdata->_textures[i]._texture;
93}
94
95/**
96 * Returns the RenderTexturePlane associated with the nth render-texture.
97 * Returns 0 if there is no such texture.
98 */
99INLINE GraphicsOutput::RenderTexturePlane GraphicsOutput::
100get_texture_plane(int i) const {
101 CDReader cdata(_cycler);
102 if ((i < 0) || (i >= ((int)cdata->_textures.size()))) {
103 return (RenderTexturePlane)0;
104 }
105 return cdata->_textures[i]._plane;
106}
107
108/**
109 * Returns the RenderTextureMode associated with the nth render-texture.
110 * Returns RTM_none if there is no such texture.
111 */
112INLINE GraphicsOutput::RenderTextureMode GraphicsOutput::
113get_rtm_mode(int i) const {
114 CDReader cdata(_cycler);
115 if ((i < 0) || (i >= ((int)cdata->_textures.size()))) {
116 return RTM_none;
117 }
118 return cdata->_textures[i]._rtm_mode;
119}
120
121/**
122 * Returns the visible size of the window or buffer, if it is known. In
123 * certain cases (e.g. fullscreen windows), the size may not be known until
124 * after the object has been fully created. Check has_size() first.
125 *
126 * Certain objects (like windows) may change size spontaneously; this method
127 * is not thread-safe. To get the size of a window in a thread-safe manner,
128 * query get_properties().
129 */
130INLINE const LVecBase2i &GraphicsOutput::
131get_size() const {
132 return _size;
133}
134
135/**
136 * Returns the visible width of the window or buffer, if it is known. In
137 * certain cases (e.g. fullscreen windows), the size may not be known until
138 * after the object has been fully created. Check has_size() first.
139 *
140 * Certain objects (like windows) may change size spontaneously; this method
141 * is not thread-safe. To get the size of a window in a thread-safe manner,
142 * query get_properties().
143 */
145get_x_size() const {
146 return _size.get_x();
147}
148
149/**
150 * Returns the visible height of the window or buffer, if it is known. In
151 * certain cases (e.g. fullscreen windows), the size may not be known until
152 * after the object has been fully created. Check has_size() first.
153 *
154 * Certain objects (like windows) may change size spontaneously; this method
155 * is not thread-safe. To get the size of a window in a thread-safe manner,
156 * query get_properties().
157 */
159get_y_size() const {
160 return _size.get_y();
161}
162
163/**
164 * Returns the internal size of the window or buffer. This is almost always
165 * the same as get_size(), except when a pixel_zoom is in effect--see
166 * set_pixel_zoom().
167 */
168INLINE LVecBase2i GraphicsOutput::
169get_fb_size() const {
170 return LVecBase2i((std::max)(int(_size.get_x() * get_pixel_factor()), 1),
171 (std::max)(int(_size.get_y() * get_pixel_factor()), 1));
172}
173
174/**
175 * Returns the internal width of the window or buffer. This is almost always
176 * the same as get_x_size(), except when a pixel_zoom is in effect--see
177 * set_pixel_zoom().
178 */
180get_fb_x_size() const {
181 return (std::max)(int(_size.get_x() * get_pixel_factor()), 1);
182}
183
184/**
185 * Returns the internal height of the window or buffer. This is almost always
186 * the same as get_y_size(), except when a pixel_zoom is in effect--see
187 * set_pixel_zoom().
188 */
190get_fb_y_size() const {
191 return (std::max)(int(_size.get_y() * get_pixel_factor()), 1);
192}
193
194/**
195 * If side-by-side stereo is enabled, this returns the pixel size of the left
196 * eye, based on scaling get_size() by get_sbs_left_dimensions(). If side-by-
197 * side stereo is not enabled, this returns the same as get_size().
198 */
199INLINE LVecBase2i GraphicsOutput::
200get_sbs_left_size() const {
201 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
202 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
203 return LVecBase2i((std::max)(int(_size.get_x() * left_w), 1),
204 (std::max)(int(_size.get_y() * left_h), 1));
205}
206
207/**
208 * If side-by-side stereo is enabled, this returns the pixel width of the left
209 * eye, based on scaling get_x_size() by get_sbs_left_dimensions(). If side-
210 * by-side stereo is not enabled, this returns the same as get_x_size().
211 */
213get_sbs_left_x_size() const {
214 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
215 return (std::max)(int(_size.get_x() * left_w), 1);
216}
217
218/**
219 * If side-by-side stereo is enabled, this returns the pixel height of the
220 * left eye, based on scaling get_y_size() by get_sbs_left_dimensions(). If
221 * side-by-side stereo is not enabled, this returns the same as get_y_size().
222 */
224get_sbs_left_y_size() const {
225 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
226 return (std::max)(int(_size.get_y() * left_h), 1);
227}
228
229/**
230 * If side-by-side stereo is enabled, this returns the pixel size of the right
231 * eye, based on scaling get_size() by get_sbs_right_dimensions(). If side-
232 * by-side stereo is not enabled, this returns the same as get_size().
233 */
234INLINE LVecBase2i GraphicsOutput::
235get_sbs_right_size() const {
236 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
237 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
238 return LVecBase2i((std::max)(int(_size.get_x() * right_w), 1),
239 (std::max)(int(_size.get_y() * right_h), 1));
240}
241
242/**
243 * If side-by-side stereo is enabled, this returns the pixel width of the
244 * right eye, based on scaling get_x_size() by get_sbs_right_dimensions(). If
245 * side-by-side stereo is not enabled, this returns the same as get_x_size().
246 */
248get_sbs_right_x_size() const {
249 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
250 return (std::max)(int(_size.get_x() * right_w), 1);
251}
252
253/**
254 * If side-by-side stereo is enabled, this returns the pixel height of the
255 * right eye, based on scaling get_y_size() by get_sbs_right_dimensions(). If
256 * side-by-side stereo is not enabled, this returns the same as get_y_size().
257 */
259get_sbs_right_y_size() const {
260 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
261 return (std::max)(int(_size.get_y() * right_h), 1);
262}
263
264/**
265 * Returns true if the size of the window/frame buffer is known, false
266 * otherwise. In certain cases the size may not be known until after the
267 * object has been fully created. Also, certain objects (like windows) may
268 * change size spontaneously.
269 */
271has_size() const {
272 return _has_size;
273}
274
275/**
276 * Returns true if the output is fully created and ready for rendering, false
277 * otherwise.
278 */
280is_valid() const {
281 return _is_valid && _is_nonzero_size;
282}
283
284/**
285 * Returns true if the output has a nonzero size in both X and Y, or false if
286 * it is zero (and therefore invalid).
287 */
289is_nonzero_size() const {
290 return _is_nonzero_size;
291}
292
293/**
294 * Returns the current setting of the inverted flag. When this is true, the
295 * scene is rendered into the window upside-down, flipped like a mirror along
296 * the X axis. See set_inverted().
297 */
298INLINE bool GraphicsOutput::
299get_inverted() const {
300 return _inverted;
301}
302
303/**
304 * Changes the "swap eyes" flag. This flag is normally false. When it is
305 * true, the left and right channels of a stereo DisplayRegion are sent to the
306 * opposite channels in the rendering backend. This is meant to work around
307 * hardware that inadvertently swaps the output channels, or hardware for
308 * which it cannot be determined which channel is which until runtime.
309 */
310INLINE void GraphicsOutput::
311set_swap_eyes(bool swap_eyes) {
312 _swap_eyes = swap_eyes;
313}
314
315/**
316 * Returns the current setting of the "swap eyes" flag. See set_swap_eyes().
317 */
318INLINE bool GraphicsOutput::
319get_swap_eyes() const {
320 return _swap_eyes;
321}
322
323/**
324 * Enables red-blue stereo mode on this particular window. When red-blue
325 * stereo mode is in effect, DisplayRegions that have the "left" channel set
326 * will render in the red (or specified) channel only, while DisplayRegions
327 * that have the "right" channel set will render in the blue (or specified)
328 * channel only.
329 *
330 * The remaining two parameters specify the particular color channel(s) to
331 * associate with each eye. Use the bits defined in
332 * ColorWriteAttrib::Channels.
333 *
334 * This can be used to achieve a cheesy stereo mode in the absence of
335 * hardware-supported stereo.
336 */
338set_red_blue_stereo(bool red_blue_stereo,
339 unsigned int left_eye_color_mask,
340 unsigned int right_eye_color_mask) {
341 _red_blue_stereo = red_blue_stereo;
342 if (_red_blue_stereo) {
343 _left_eye_color_mask = left_eye_color_mask;
344 _right_eye_color_mask = right_eye_color_mask;
345 } else {
346 _left_eye_color_mask = 0x0f;
347 _right_eye_color_mask = 0x0f;
348 }
349}
350
351/**
352 * Returns whether red-blue stereo mode is in effect for this particular
353 * window. See set_red_blue_stereo().
354 */
356get_red_blue_stereo() const {
357 return _red_blue_stereo;
358}
359
360/**
361 * Returns the color mask in effect when rendering a left-eye view in red_blue
362 * stereo mode. This is one or more bits defined in
363 * ColorWriteAttrib::Channels. See set_red_blue_stereo().
364 */
365INLINE unsigned int GraphicsOutput::
367 return _left_eye_color_mask;
368}
369
370/**
371 * Returns the color mask in effect when rendering a right-eye view in
372 * red_blue stereo mode. This is one or more bits defined in
373 * ColorWriteAttrib::Channels. See set_red_blue_stereo().
374 */
375INLINE unsigned int GraphicsOutput::
377 return _right_eye_color_mask;
378}
379
380/**
381 * Returns whether side-by-side stereo mode is in effect for this particular
382 * window. See set_side_by_side_stereo().
383 */
386 return _side_by_side_stereo;
387}
388
389/**
390 * Returns the effective sub-region of the window for displaying the left
391 * channel, if side-by-side stereo mode is in effect for the window. See
392 * set_side_by_side_stereo().
393 */
394INLINE const LVecBase4 &GraphicsOutput::
396 return _sbs_left_dimensions;
397}
398
399/**
400 * Returns the effective sub-region of the window for displaying the right
401 * channel, if side-by-side stereo mode is in effect for the window. See
402 * set_side_by_side_stereo().
403 */
404INLINE const LVecBase4 &GraphicsOutput::
406 return _sbs_right_dimensions;
407}
408
409/**
410 * Returns the framebuffer properties of the window.
411 */
413get_fb_properties() const {
414 return _fb_properties;
415}
416
417/**
418 * Returns Returns true if this window can render stereo DisplayRegions,
419 * either through red-blue stereo (see set_red_blue_stereo()) or through true
420 * hardware stereo rendering.
421 */
423is_stereo() const {
424 return _red_blue_stereo || _side_by_side_stereo || _fb_properties.is_stereo();
425}
426
427/**
428 * Resets the delete flag, so the GraphicsOutput will not be automatically
429 * deleted before the beginning of the next frame.
430 */
433 _delete_flag = false;
434}
435
436/**
437 * Returns the sorting order of this particular GraphicsOutput. The various
438 * GraphicsOutputs within a particular thread will be rendered in the
439 * indicated order.
440 */
441INLINE int GraphicsOutput::
442get_sort() const {
443 return _sort;
444}
445
446/**
447 * Specifies the sort value of future offscreen buffers created by
448 * make_texture_sort().
449 *
450 * The purpose of this method is to allow the user to limit the sort value
451 * chosen for a buffer created via make_texture_buffer(). Normally, this
452 * buffer will be assigned a value of get_sort() - 1, so that it will be
453 * rendered before this window is rendered; but sometimes this isn't
454 * sufficiently early, especially if other buffers also have a view into the
455 * same scene.
456 *
457 * If you specify a value here, then new buffers created via
458 * make_texture_buffer() will be given that sort value instead of get_sort() -
459 * 1.
460 */
461INLINE void GraphicsOutput::
462set_child_sort(int child_sort) {
463 _child_sort = child_sort;
464 _got_child_sort = true;
465}
466
467/**
468 * Resets the sort value of future offscreen buffers created by
469 * make_texture_sort() to the default value. See set_child_sort().
470 */
473 _got_child_sort = false;
474}
475
476/**
477 * Returns the sort value of future offscreen buffers created by
478 * make_texture_sort(). See set_child_sort().
479 */
480INLINE int GraphicsOutput::
481get_child_sort() const {
482 if (_got_child_sort) {
483 return _child_sort;
484 } else {
485 return get_sort() - 1;
486 }
487}
488
489/**
490 * When the GraphicsOutput is in triggered copy mode, this function triggers
491 * the copy (at the end of the next frame).
492 * @returns a future that can be awaited.
493 */
495trigger_copy() {
496 AsyncFuture *future = _trigger_copy;
497 if (future == nullptr) {
498 future = new AsyncFuture;
499 _trigger_copy = future;
500 }
501 return future;
502}
503
504/**
505 * Creates a new DisplayRegion that covers the entire window.
506 *
507 * If is_stereo() is true for this window, and default-stereo-camera is
508 * configured true, this actually makes a StereoDisplayRegion. Call
509 * make_mono_display_region() or make_stereo_display_region() if you want to
510 * insist on one or the other.
511 */
514 return make_display_region(0.0f, 1.0f, 0.0f, 1.0f);
515}
516
517/**
518 * Creates a new DisplayRegion that covers the indicated sub-rectangle within
519 * the window. The range on all parameters is 0..1.
520 *
521 * If is_stereo() is true for this window, and default-stereo-camera is
522 * configured true, this actually makes a StereoDisplayRegion. Call
523 * make_mono_display_region() or make_stereo_display_region() if you want to
524 * insist on one or the other.
525 */
527make_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
528 return make_display_region(LVecBase4(l, r, b, t));
529}
530
531/**
532 * Creates a new DisplayRegion that covers the entire window.
533 *
534 * This generally returns a mono DisplayRegion, even if is_stereo() is true.
535 * However, if side-by-side stereo is enabled, this will return a
536 * StereoDisplayRegion whose two eyes are both set to SC_mono. (This is
537 * necessary because in side-by-side stereo mode, it is necessary to draw even
538 * mono DisplayRegions twice).
539 */
542 return make_mono_display_region(0.0f, 1.0f, 0.0f, 1.0f);
543}
544
545/**
546 * Creates a new DisplayRegion that covers the entire window.
547 *
548 * This generally returns a mono DisplayRegion, even if is_stereo() is true.
549 * However, if side-by-side stereo is enabled, this will return a
550 * StereoDisplayRegion whose two eyes are both set to SC_mono. (This is
551 * necessary because in side-by-side stereo mode, it is necessary to draw even
552 * mono DisplayRegions twice).
553 */
555make_mono_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
556 return make_mono_display_region(LVecBase4(l, r, b, t));
557}
558
559/**
560 * Creates a new DisplayRegion that covers the entire window.
561 *
562 * This always returns a stereo DisplayRegion, even if is_stereo() is false.
563 */
568
569/**
570 * Creates a new DisplayRegion that covers the entire window.
571 *
572 * This always returns a stereo DisplayRegion, even if is_stereo() is false.
573 */
575make_stereo_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
576 return make_stereo_display_region(LVecBase4(l, r, b, t));
577}
578
579/**
580 * Returns the special "overlay" DisplayRegion that is created for each window
581 * or buffer. This DisplayRegion covers the entire window, but cannot be used
582 * for rendering. It is a placeholder only, to indicate the dimensions of the
583 * window, and is usually used internally for purposes such as clearing the
584 * window, or grabbing a screenshot of the window.
585 *
586 * There are very few applications that require access to this DisplayRegion.
587 * Normally, you should create your own DisplayRegion that covers the window,
588 * if you want to render to the window.
589 */
592 return _overlay_display_region;
593}
594
595/**
596 * Saves a screenshot of the region to a default filename, and returns the
597 * filename, or empty string if the screenshot failed. The default filename
598 * is generated from the supplied prefix and from the Config variable
599 * screenshot-filename, which contains the following strings:
600 *
601 * %~p - the supplied prefix %~f - the frame count %~e - the value of
602 * screenshot-extension All other % strings in strftime().
603 */
605make_screenshot_filename(const std::string &prefix) {
607}
608
609/**
610 * Saves a screenshot of the region to a default filename, and returns the
611 * filename, or empty string if the screenshot failed. The filename is
612 * generated by make_screenshot_filename().
613 */
615save_screenshot_default(const std::string &prefix) {
616 return _overlay_display_region->save_screenshot_default(prefix);
617}
618
619/**
620 * Saves a screenshot of the region to the indicated filename. The image
621 * comment is an optional user readable string that will be saved with the
622 * header of the image (if the file format supports embedded data; for example
623 * jpg allows comments). Returns true on success, false on failure.
624 */
626save_screenshot(const Filename &filename, const std::string &image_comment) {
627 return _overlay_display_region->save_screenshot(filename, image_comment);
628}
629
630/**
631 * Captures the most-recently rendered image from the framebuffer into the
632 * indicated PNMImage. Returns true on success, false on failure.
633 */
635get_screenshot(PNMImage &image) {
636 return _overlay_display_region->get_screenshot(image);
637}
638
639/**
640 * Captures the most-recently rendered image from the framebuffer and returns
641 * it as Texture, or NULL on failure.
642 */
645 return _overlay_display_region->get_screenshot();
646}
647
648/**
649 * The sorting operator is used to order the GraphicsOutput object in order by
650 * their sort number, so that they will render in the correct order in the
651 * GraphicsEngine.
652 */
654operator < (const GraphicsOutput &other) const {
655 if (_sort != other._sort) {
656 return _sort < other._sort;
657 }
658 return _internal_sort_index < other._internal_sort_index;
659}
660
661
662/**
663 * Recomputes the list of active DisplayRegions within the window, if they
664 * have changed recently.
665 */
666INLINE void GraphicsOutput::
667determine_display_regions() const {
668 // This function isn't strictly speaking const, but we pretend it is because
669 // it only updates a transparent cache value.
670 CDLockedReader cdata(_cycler);
671 if (cdata->_active_display_regions_stale) {
672 CDWriter cdataw(((GraphicsOutput *)this)->_cycler, cdata, false);
673 ((GraphicsOutput *)this)->do_determine_display_regions(cdataw);
674 }
675}
676
677/**
678 * Intended to be called when the active state on a nested display region
679 * changes, forcing the window to recompute its list of active display
680 * regions.
681 */
682INLINE void GraphicsOutput::
683win_display_regions_changed() {
684 CDWriter cdata(_cycler, true);
685 cdata->_active_display_regions_stale = true;
686}
687
688/**
689 * Returns a PStatCollector for timing the cull operation for just this
690 * GraphicsOutput.
691 */
694 return _cull_window_pcollector;
695}
696
697/**
698 * Returns a PStatCollector for timing the draw operation for just this
699 * GraphicsOutput.
700 */
703 return _draw_window_pcollector;
704}
705
706/**
707 * Returns a PStatCollector for timing the clear operation for just this
708 * GraphicsOutput.
709 */
712 return _clear_window_pcollector;
713}
714
715/**
716 * Display the spam message associated with begin_frame
717 */
718INLINE void GraphicsOutput::
719begin_frame_spam(FrameMode mode) {
720 if (display_cat.is_spam()) {
721 display_cat.spam()
722 << "begin_frame(" << mode << "): " << get_type() << " "
723 << get_name() << " " << (void *)this << "\n";
724 }
725}
726
727/**
728 * Display the spam message associated with end_frame
729 */
730INLINE void GraphicsOutput::
731end_frame_spam(FrameMode mode) {
732 if (display_cat.is_spam()) {
733 display_cat.spam()
734 << "end_frame(" << mode << "): " << get_type() << " "
735 << get_name() << " " << (void *)this << "\n";
736 }
737}
738
739/**
740 * Clear the variables that select a cube-map face (or other multipage texture
741 * face).
742 */
743INLINE void GraphicsOutput::
744clear_cube_map_selection() {
745 _target_tex_page = -1;
746 _prev_page_dr = nullptr;
747}
748
749/**
750 * To be called at the end of the frame, after the window has successfully
751 * been drawn and is ready to be flipped (if appropriate).
752 */
753INLINE void GraphicsOutput::
754trigger_flip() {
755 if (!_fb_properties.is_single_buffered()) {
756 _flip_ready = true;
757 }
758}
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
Definition asyncFuture.h:61
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
A rectangular subregion within a window for rendering into.
static Filename make_screenshot_filename(const std::string &prefix="screenshot")
Synthesizes a suitable default filename for passing to save_screenshot().
get_pixel_factor
Returns the amount by which the height and width of the region will be scaled internally,...
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
set_swap_eyes
Changes the "swap eyes" flag.
bool has_texture() const
Returns true if the GraphicsOutput is rendering into any textures at all.
int get_fb_x_size() const
Returns the internal width of the window or buffer.
get_inverted
Returns the current setting of the inverted flag.
get_pipe
Returns the GraphicsPipe that this window is associated with.
bool has_size() const
Returns true if the size of the window/frame buffer is known, false otherwise.
bool operator<(const GraphicsOutput &other) const
The sorting operator is used to order the GraphicsOutput object in order by their sort number,...
void clear_child_sort()
Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value...
get_gsg
Returns the GSG that is associated with this window.
get_sbs_left_size
If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_...
int count_textures() const
If the GraphicsOutput is set to render into a texture, returns the number of textures that are being ...
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...
PStatCollector & get_draw_window_pcollector()
Returns a PStatCollector for timing the draw operation for just this GraphicsOutput.
PStatCollector & get_cull_window_pcollector()
Returns a PStatCollector for timing the cull operation for just this GraphicsOutput.
get_fb_size
Returns the internal size of the window or buffer.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.
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 ...
StereoDisplayRegion * make_stereo_display_region()
Creates a new DisplayRegion that covers the entire window.
DisplayRegion * make_mono_display_region()
Creates a new DisplayRegion that covers the entire window.
bool get_side_by_side_stereo() const
Returns whether side-by-side stereo mode is in effect for this particular window.
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 ge...
bool get_screenshot(PNMImage &image)
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.
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 ...
RenderTexturePlane get_texture_plane(int i=0) const
Returns the RenderTexturePlane associated with the nth render-texture.
DisplayRegion * get_overlay_display_region() const
Returns 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.
get_child_sort
Returns the sort value of future offscreen buffers created by make_texture_sort().
void clear_delete_flag()
Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning ...
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.
int get_fb_y_size() const
Returns the internal height of the window or buffer.
DisplayRegion * make_display_region()
Creates a new DisplayRegion that covers the entire window.
get_size
Returns the visible size of the window or buffer, if it is known.
get_sbs_right_size
If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get...
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 ...
get_swap_eyes
Returns the current setting of the "swap eyes" flag.
get_engine
Returns the graphics engine that created this output.
bool is_valid() const
Returns true if the output is fully created and ready for rendering, false otherwise.
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
const LVecBase4 & get_sbs_left_dimensions() const
Returns the effective sub-region of the window for displaying the left channel, if side-by-side stere...
get_sort
Returns the sorting order of this particular GraphicsOutput.
get_name
Returns the name that was passed to the GraphicsOutput constructor.
set_child_sort
Specifies the sort value of future offscreen buffers created by make_texture_sort().
PStatCollector & get_clear_window_pcollector()
Returns a PStatCollector for timing the clear operation for just this GraphicsOutput.
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.
RenderTextureMode get_rtm_mode(int i=0) const
Returns the RenderTextureMode associated with the nth render-texture.
bool is_stereo() const
Returns Returns true if this window can render stereo DisplayRegions, either through red-blue stereo ...
bool get_red_blue_stereo() const
Returns whether red-blue stereo mode is in effect for this particular window.
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 ge...
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
AsyncFuture * trigger_copy()
When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the...
bool save_screenshot(const Filename &filename, const std::string &image_comment="")
Saves a screenshot of the region to the indicated filename.
int get_sbs_right_y_size() const
If side-by-side stereo is enabled, this returns the pixel height of the right eye,...
virtual Texture * get_texture(int i=0) const
Returns the nth texture into which the GraphicsOutput renders.
const LVecBase4 & get_sbs_right_dimensions() const
Returns the effective sub-region of the window for displaying the right channel, if side-by-side ster...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Definition pnmImage.h:58
A lightweight class that represents a single element that may be timed and/or counted via stats.
This is a special DisplayRegion wrapper that actually includes a pair of DisplayRegions internally: t...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72