perform render thumbnail only if framebuffer available

This commit is contained in:
Bruno
2021-04-28 11:23:11 +02:00
parent 7b7bd763c9
commit a28f46a9eb

View File

@@ -76,16 +76,11 @@ void RenderView::draw()
scene.root()->draw(glm::identity<glm::mat4>(), P); scene.root()->draw(glm::identity<glm::mat4>(), P);
fading_overlay_->draw(glm::identity<glm::mat4>(), projection); fading_overlay_->draw(glm::identity<glm::mat4>(), projection);
frame_buffer_->end(); frame_buffer_->end();
}
// if a thumbnailer is pending // if a thumbnailer is pending
if (thumbnailer_.size() > 0) { if (thumbnailer_.size() > 0) {
try { try {
// promise will fail if no framebuffer
if ( frame_buffer_ == nullptr )
throw std::runtime_error("no frame");
// new thumbnailing framebuffer // new thumbnailing framebuffer
FrameBuffer *frame_thumbnail = new FrameBuffer( glm::vec3(SESSION_THUMBNAIL_HEIGHT * frame_buffer_->aspectRatio(), SESSION_THUMBNAIL_HEIGHT, 1.f) ); FrameBuffer *frame_thumbnail = new FrameBuffer( glm::vec3(SESSION_THUMBNAIL_HEIGHT * frame_buffer_->aspectRatio(), SESSION_THUMBNAIL_HEIGHT, 1.f) );
@@ -116,7 +111,7 @@ void RenderView::draw()
// done with this promise // done with this promise
thumbnailer_.pop_back(); thumbnailer_.pop_back();
} }
}
} }
@@ -136,7 +131,8 @@ FrameBufferImage *RenderView::thumbnail ()
img = t.get(); img = t.get();
} }
// catch any failed promise // catch any failed promise
catch (std::runtime_error&){ } catch (std::runtime_error&){
}
return img; return img;
} }