37 const std::string &name,
46 DCAST_INTO_V(egl_pipe, _pipe);
47 _egl_display = egl_pipe->_egl_display;
55 ~eglGraphicsWindow() {
66 PStatTimer timer(_make_current_pcollector, current_thread);
68 begin_frame_spam(mode);
69 if (_gsg ==
nullptr) {
72 if (_awaiting_configure) {
79 DCAST_INTO_R(eglgsg, _gsg,
false);
83 if (eglGetCurrentDisplay() == _egl_display &&
84 eglGetCurrentSurface(EGL_READ) == _egl_surface &&
85 eglGetCurrentSurface(EGL_DRAW) == _egl_surface &&
86 eglGetCurrentContext() == eglgsg->_context) {
91 if (!eglMakeCurrent(_egl_display, _egl_surface, _egl_surface, eglgsg->_context)) {
92 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: " 102 eglgsg->reset_if_new();
104 if (mode == FM_render) {
106 clear_cube_map_selection();
110 return _gsg->begin_frame(current_thread);
120 end_frame_spam(mode);
121 nassertv(_gsg !=
nullptr);
123 if (mode == FM_render) {
128 _gsg->end_frame(current_thread);
130 if (mode == FM_render) {
132 clear_cube_map_selection();
145 if (_gsg !=
nullptr && _flip_ready) {
154 eglSwapBuffers(_egl_display, _egl_surface);
162 void eglGraphicsWindow::
164 if (_gsg !=
nullptr) {
165 if (!eglMakeCurrent(_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
166 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: " 172 if (_ic != (XIC)
nullptr) {
177 if (_egl_surface != 0) {
178 if (!eglDestroySurface(_egl_display, _egl_surface)) {
179 egldisplay_cat.error() <<
"Failed to destroy surface: " 184 if (_xwindow != (X11_Window)
nullptr) {
185 XDestroyWindow(_display, _xwindow);
186 _xwindow = (X11_Window)
nullptr;
192 GraphicsWindow::close_window();
199 bool eglGraphicsWindow::
202 DCAST_INTO_R(egl_pipe, _pipe,
false);
214 DCAST_INTO_R(eglgsg, _gsg,
false);
222 _visual_info = eglgsg->_visual;
223 if (_visual_info ==
nullptr) {
225 egldisplay_cat.error()
226 <<
"No X visual: cannot open window.\n";
230 setup_colormap(_visual_info);
232 if (!x11GraphicsWindow::open_window()) {
236 _egl_surface = eglCreateWindowSurface(_egl_display, eglgsg->_fbconfig, (NativeWindowType) _xwindow,
nullptr);
237 if (eglGetError() != EGL_SUCCESS) {
238 egldisplay_cat.error()
239 <<
"Failed to create window surface.\n";
243 if (!eglMakeCurrent(_egl_display, _egl_surface, _egl_surface, eglgsg->_context)) {
244 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: " 247 eglgsg->reset_if_new();
248 if (!eglgsg->is_valid()) {
253 (_fb_properties, eglgsg->get_gl_renderer())) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This graphics pipe represents the interface for creating OpenGL ES graphics windows on an X-based (e....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
int get_screen() const
Returns the X screen number associated with the pipe.
const std::string get_egl_error_string(int error)
Returns the given EGL error as string.
An object to create GraphicsOutputs that share a particular 3-D API.
X11_Display * get_display() const
Returns a pointer to the X display associated with the pipe: the display on which to create the windo...
This is a base class for the various different classes that represent the result of a frame of render...
bool verify_hardware_software(const FrameBufferProperties &props, const std::string &renderer) const
Validates that the properties represent the desired kind of renderer (hardware or software).
Similar to MutexHolder, but for a light reentrant mutex.
void choose_pixel_format(const FrameBufferProperties &properties, X11_Display *_display, int _screen, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend.
A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific information.
bool subsumes(const FrameBufferProperties &other) const
Returns true if this set of properties makes strictly greater or equal demands of the framebuffer tha...
This class is the main interface to controlling the render process.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
TypeHandle is the identifier used to differentiate C++ class types.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Interfaces to the X11 window system.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.