mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 05:24:06 +02:00
Merge pull request #8162 from SamGondelman/snapshotFix
Snapshot takes picture of HMD window instead of preview
This commit is contained in:
commit
372f8245e6
1 changed files with 5 additions and 4 deletions
|
@ -647,12 +647,13 @@ void OpenGLDisplayPlugin::withMainThreadContext(std::function<void()> f) const {
|
|||
}
|
||||
|
||||
QImage OpenGLDisplayPlugin::getScreenshot() const {
|
||||
QImage result;
|
||||
using namespace oglplus;
|
||||
QImage screenshot(_compositeFramebuffer->size.x, _compositeFramebuffer->size.y, QImage::Format_RGBA8888);
|
||||
withMainThreadContext([&] {
|
||||
static auto widget = _container->getPrimaryWidget();
|
||||
result = widget->grabFrameBuffer();
|
||||
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());
|
||||
});
|
||||
return result;
|
||||
return screenshot.mirrored(false, true);
|
||||
}
|
||||
|
||||
uint32_t OpenGLDisplayPlugin::getSceneTextureId() const {
|
||||
|
|
Loading…
Reference in a new issue