25 int x_size,
int y_size,
int flags) :
27 name, host->get_fb_properties(),
29 host->get_gsg(), host, false)
31 #ifdef DO_MEMORY_USAGE 35 if (display_cat.is_debug()) {
37 <<
"Creating new parasite buffer " <<
get_name()
38 <<
" on " << _host->get_name() <<
"\n";
41 _creation_flags = flags;
43 if (flags & GraphicsPipe::BF_size_track_host) {
46 _size.set(x_size, y_size);
50 _overlay_display_region->compute_pixels(_size.get_x(), _size.get_y());
80 if ((_creation_flags & GraphicsPipe::BF_resizeable) == 0) {
81 nassert_raise(
"Cannot resize buffer unless it is created with BF_resizeable flag");
84 set_size_and_recalc(x, y);
91 set_size_and_recalc(
int x,
int y) {
92 if (!(_creation_flags & GraphicsPipe::BF_size_track_host)) {
93 if (_creation_flags & GraphicsPipe::BF_size_power_2) {
97 if (_creation_flags & GraphicsPipe::BF_size_square) {
98 x = y = std::min(x, y);
111 nassertr(_host !=
nullptr,
false);
112 return _host->flip_ready();
128 nassertv(_host !=
nullptr);
143 nassertv(_host !=
nullptr);
156 nassertv(_host !=
nullptr);
169 begin_frame_spam(mode);
171 if (!_host->begin_frame(FM_parasite, current_thread)) {
175 if (_creation_flags & GraphicsPipe::BF_size_track_host) {
176 if (_host->get_size() != _size) {
177 set_size_and_recalc(_host->get_x_size(),
178 _host->get_y_size());
183 set_size_and_recalc(std::min(
get_x_size(), _host->get_x_size()),
188 clear_cube_map_selection();
199 end_frame_spam(mode);
201 nassertv(_gsg !=
nullptr);
203 _host->end_frame(FM_parasite, current_thread);
205 if (mode == FM_refresh) {
209 if (mode == FM_render) {
210 promote_to_copy_texture();
212 clear_cube_map_selection();
ParasiteBuffer(GraphicsOutput *host, const std::string &name, int x_size, int y_size, int flags)
Normally, the ParasiteBuffer constructor is not called directly; these are created instead via the Gr...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
get_size
Returns the visible size of the window or buffer, if it is known.
void set_size_and_recalc(int x, int y)
Changes the x_size and y_size, then recalculates structures that depend on size.
virtual bool is_active() const
Returns true if the window is ready to be rendered into, false otherwise.
virtual GraphicsOutput * get_host()
This is normally called only from within make_texture_buffer().
is_active
Returns true if the window is ready to be rendered into, false otherwise.
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
virtual bool flip_ready() const
Returns true if a frame has been rendered and needs to be flipped, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
virtual void ready_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
This is a base class for the various different classes that represent the result of a frame of render...
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_name
Returns the name that was passed to the GraphicsOutput constructor.
void set_size(int x, int y)
This is called by the GraphicsEngine to request that the buffer resize itself.
A thread; that is, a lightweight process.
static int down_to_power_2(int value)
Returns the largest power of 2 less than or equal to value.
TypeHandle is the identifier used to differentiate C++ class types.
set_inverted
Changes the current setting of the inverted flag.
get_gsg
Returns the GSG that is associated with this window.