From 029721fd457bb750000a8cb79b4ca94eb4829dcb Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 8 Aug 2016 10:17:12 -0700 Subject: [PATCH] Restore screenshot --- .../src/display-plugins/OpenGLDisplayPlugin.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 927c4dc0f7..af3097ba7a 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -665,17 +665,13 @@ void OpenGLDisplayPlugin::withMainThreadContext(std::function f) const { } QImage OpenGLDisplayPlugin::getScreenshot() const { -#if 0 - using namespace oglplus; - QImage screenshot(_compositeFramebuffer->size.x, _compositeFramebuffer->size.y, QImage::Format_RGBA8888); + auto size = _compositeFramebuffer->getSize(); + auto glBackend = const_cast(*this).getGLBackend(); + QImage screenshot(size.x, size.y, QImage::Format_ARGB32); withMainThreadContext([&] { - Framebuffer::Bind(Framebuffer::Target::Read, _compositeFramebuffer->fbo); - Context::ReadPixels(0, 0, _compositeFramebuffer->size.x, _compositeFramebuffer->size.y, enums::PixelDataFormat::RGBA, enums::PixelDataType::UnsignedByte, screenshot.bits()); + glBackend->downloadFramebuffer(_compositeFramebuffer, ivec4(uvec2(0), size), screenshot); }); return screenshot.mirrored(false, true); -#else - return QImage(); -#endif } glm::uvec2 OpenGLDisplayPlugin::getSurfacePixels() const {