29 const std::string &name,
35 GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
38 DCAST_INTO_V(egl_pipe, _pipe);
39 _pbuffer = EGL_NO_SURFACE;
43 _screenshot_buffer_type = _draw_buffer_type;
50 ~eglGraphicsBuffer() {
51 nassertv(_pbuffer == EGL_NO_SURFACE);
62 PStatTimer timer(_make_current_pcollector, current_thread);
64 begin_frame_spam(mode);
65 if (_gsg ==
nullptr) {
70 DCAST_INTO_R(eglgsg, _gsg,
false);
71 if (!eglMakeCurrent(eglgsg->_egl_display, _pbuffer, _pbuffer, eglgsg->_context)) {
72 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: "
80 eglgsg->reset_if_new();
82 if (mode == FM_render) {
84 for (
size_t i = 0; i != cdata->_textures.size(); ++i) {
85 const RenderTexture &rt = cdata->_textures[i];
86 RenderTextureMode rtm_mode = rt._rtm_mode;
87 if (rtm_mode == RTM_bind_or_copy) {
88 CDWriter cdataw(_cycler, cdata,
false);
89 nassertr(cdata->_textures.size() == cdataw->_textures.size(),
false);
90 cdataw->_textures[i]._rtm_mode = RTM_copy_texture;
93 clear_cube_map_selection();
97 return _gsg->begin_frame(current_thread);
107 end_frame_spam(mode);
108 nassertv(_gsg !=
nullptr);
110 if (mode == FM_render) {
114 _gsg->end_frame(current_thread);
116 if (mode == FM_render) {
118 clear_cube_map_selection();
125 void eglGraphicsBuffer::
127 if (_gsg !=
nullptr) {
129 DCAST_INTO_V(eglgsg, _gsg);
130 if (!eglMakeCurrent(_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
131 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: "
136 if (_pbuffer != EGL_NO_SURFACE) {
137 if (!eglDestroySurface(_egl_display, _pbuffer)) {
138 egldisplay_cat.error() <<
"Failed to destroy surface: "
141 _pbuffer = EGL_NO_SURFACE;
152 bool eglGraphicsBuffer::
155 DCAST_INTO_R(egl_pipe, _pipe,
false);
167 DCAST_INTO_R(eglgsg, _gsg,
false);
175 if (eglgsg->_fbconfig ==
nullptr) {
181 _egl_display = eglgsg->_egl_display;
183 int attrib_list[] = {
184 EGL_WIDTH, _size.get_x(),
185 EGL_HEIGHT, _size.get_y(),
189 _pbuffer = eglCreatePbufferSurface(eglgsg->_egl_display, eglgsg->_fbconfig, attrib_list);
191 if (_pbuffer == EGL_NO_SURFACE) {
192 egldisplay_cat.error()
193 <<
"Failed to create EGL pbuffer surface: "
198 if (!eglMakeCurrent(eglgsg->_egl_display, _pbuffer, _pbuffer, eglgsg->_context)) {
199 egldisplay_cat.error() <<
"Failed to call eglMakeCurrent: "
202 eglgsg->reset_if_new();
203 if (!eglgsg->is_valid()) {
208 (_fb_properties, eglgsg->get_gl_renderer())) {
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
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).
bool subsumes(const FrameBufferProperties &other) const
Returns true if this set of properties makes strictly greater or equal demands of the framebuffer tha...
An offscreen buffer for rendering into.
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...
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.
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.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
A thread; that is, a lightweight process.
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 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.
This graphics pipe represents the interface for creating OpenGL ES graphics windows on an X-based (e....
A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific information.
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
void choose_pixel_format(const FrameBufferProperties &properties, eglGraphicsPipe *egl_pipe, bool need_window, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
const std::string get_egl_error_string(int error)
Returns the given EGL error as string.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.