16 TypeHandle CallbackGraphicsWindow::_type_handle;
17 TypeHandle CallbackGraphicsWindow::WindowCallbackData::_type_handle;
18 TypeHandle CallbackGraphicsWindow::EventsCallbackData::_type_handle;
19 TypeHandle CallbackGraphicsWindow::PropertiesCallbackData::_type_handle;
20 TypeHandle CallbackGraphicsWindow::RenderCallbackData::_type_handle;
25 CallbackGraphicsWindow::
27 const std::string &name,
32 GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, nullptr)
34 #ifdef DO_MEMORY_USAGE 39 _properties.set_origin(0, 0);
40 _properties.set_size(0, 0);
46 CallbackGraphicsWindow::
47 ~CallbackGraphicsWindow() {
56 return add_input_device(GraphicsWindowInputDevice::pointer_and_keyboard(
this, name));
68 if (_render_callback !=
nullptr) {
70 _render_callback->do_callback(&data);
71 result = data.get_render_flag();
83 return _gsg->begin_frame(current_thread);
93 if (_render_callback !=
nullptr) {
96 _gsg->set_state_and_transform(RenderState::make_empty(), _gsg->get_internal_transform());
97 _gsg->clear_before_callback();
100 _render_callback->do_callback(&data);
105 _gsg->end_frame(current_thread);
107 if (mode == FM_render) {
109 clear_cube_map_selection();
126 if (_render_callback !=
nullptr) {
128 _render_callback->do_callback(&data);
143 if (_render_callback !=
nullptr) {
145 _render_callback->do_callback(&data);
160 if (_events_callback !=
nullptr) {
162 _events_callback->do_callback(&data);
174 if (_properties_callback !=
nullptr) {
176 _properties_callback->do_callback(&data);
186 bool CallbackGraphicsWindow::
193 _fb_properties.set_rgb_color(1);
195 if (_fb_properties.get_color_bits() == 0) {
196 _fb_properties.set_color_bits(16);
207 bool CallbackGraphicsWindow::
208 do_reshape_request(
int x_origin,
int y_origin,
bool has_origin,
209 int x_size,
int y_size) {
215 properties.
set_size(x_size, y_size);
216 system_changed_properties(properties);
226 _window->GraphicsWindow::process_events();
234 _window->GraphicsWindow::set_properties_now(_properties);
242 switch (_callback_type) {
243 case RCT_begin_frame:
245 bool render_flag = _window->GraphicsWindow::begin_frame(_frame_mode, Thread::get_current_thread());
246 set_render_flag(render_flag);
251 _window->GraphicsWindow::end_frame(_frame_mode, Thread::get_current_thread());
255 _window->GraphicsWindow::begin_flip();
259 _window->GraphicsWindow::end_flip();
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
set_size
Specifies the requested size of the window, in pixels.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
set_origin
Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window s...
An object to create GraphicsOutputs that share a particular 3-D API.
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
int create_input_device(const std::string &name)
Adds a new input device (mouse) to the window with the indicated name.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
A thread; that is, a lightweight process.
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
Encapsulates all the communication with a particular instance of a given rendering backend.
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
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 frameBuffer before...
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 upcall()
You should make this call during the callback if you want to continue the normal function that would ...
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.