egldisplay: make pbuffers resizeable

This commit is contained in:
rdb 2023-04-08 10:37:13 +02:00
parent 21d7a83bfc
commit f5d5340ad3
3 changed files with 26 additions and 1 deletions

View File

@ -120,6 +120,30 @@ end_frame(FrameMode mode, Thread *current_thread) {
}
}
/**
*
*/
void eglGraphicsBuffer::
set_size(int x, int y) {
nassertv_always(_gsg != nullptr);
if (_size.get_x() != x || _size.get_y() != y) {
eglDestroySurface(_egl_display, _pbuffer);
int attrib_list[] = {
EGL_WIDTH, x,
EGL_HEIGHT, y,
EGL_NONE
};
eglGraphicsStateGuardian *eglgsg;
DCAST_INTO_V(eglgsg, _gsg);
_pbuffer = eglCreatePbufferSurface(eglgsg->_egl_display, eglgsg->_fbconfig, attrib_list);
}
set_size_and_recalc(x, y);
}
/**
* Closes the buffer right now. Called from the window thread.
*/

View File

@ -36,6 +36,8 @@ public:
virtual bool begin_frame(FrameMode mode, Thread *current_thread);
virtual void end_frame(FrameMode mode, Thread *current_thread);
virtual void set_size(int x, int y);
protected:
virtual void close_buffer();
virtual bool open_buffer();

View File

@ -323,7 +323,6 @@ make_output(const std::string &name,
if (retry == 2) {
if (((flags&BF_require_parasite)!=0)||
((flags&BF_require_window)!=0)||
((flags&BF_resizeable)!=0)||
((flags&BF_size_track_host)!=0)) {
return nullptr;
}