mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:06:02 +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 OpenGLDisplayPlugin::getScreenshot() const {
|
||||||
QImage result;
|
using namespace oglplus;
|
||||||
|
QImage screenshot(_compositeFramebuffer->size.x, _compositeFramebuffer->size.y, QImage::Format_RGBA8888);
|
||||||
withMainThreadContext([&] {
|
withMainThreadContext([&] {
|
||||||
static auto widget = _container->getPrimaryWidget();
|
Framebuffer::Bind(Framebuffer::Target::Read, _compositeFramebuffer->fbo);
|
||||||
result = widget->grabFrameBuffer();
|
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 {
|
uint32_t OpenGLDisplayPlugin::getSceneTextureId() const {
|
||||||
|
|
Loading…
Reference in a new issue