Take screenshot from back buffer when using double buffering (#14904)

Fixes #14901 (black screenshots on Wayland)
This commit is contained in:
Francesco Gazzetta 2024-08-04 16:40:21 +00:00 committed by GitHub
parent 95a0cc8f9a
commit 10fd41b4a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3018,7 +3018,7 @@ IImage *COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
if (newImage) if (newImage)
pixels = static_cast<u8 *>(newImage->getData()); pixels = static_cast<u8 *>(newImage->getData());
if (pixels) { if (pixels) {
glReadBuffer(GL_FRONT); glReadBuffer(Params.Doublebuffer ? GL_BACK : GL_FRONT);
glReadPixels(0, 0, ScreenSize.Width, ScreenSize.Height, fmt, type, pixels); glReadPixels(0, 0, ScreenSize.Width, ScreenSize.Height, fmt, type, pixels);
testGLError(__LINE__); testGLError(__LINE__);
glReadBuffer(GL_BACK); glReadBuffer(GL_BACK);