Render text informing of ongoing shutdown (#696)

This commit is contained in:
Alexander Bock
2018-08-24 03:15:55 -06:00
parent 63561d685f
commit 67dd887e52
3 changed files with 24 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ public:
bool mouseActivationCallback(const glm::dvec2& mousePosition) const;
void renderOverlays(const ShutdownInformation& shutdownInfo);
void renderEndscreen();
void postDraw();
// Performance measurements

View File

@@ -760,6 +760,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
void OpenSpaceEngine::deinitialize() {
LTRACE("OpenSpaceEngine::deinitialize(begin)");
// We want to render an image informing the user that we are shutting down
_renderEngine->renderEndscreen();
_engine->_windowWrapper->swapBuffer();
for (const std::function<void()>& func : _engine->_moduleCallbacks.deinitializeGL) {
func();
}
@@ -1235,6 +1240,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
if (_shutdown.inShutdown) {
if (_shutdown.timer <= 0.f) {
_windowWrapper->terminate();
return;
}
_shutdown.timer -= static_cast<float>(_windowWrapper->averageDeltaTime());
}

View File

@@ -639,6 +639,23 @@ void RenderEngine::renderOverlays(const ShutdownInformation& shutdownInfo) {
}
}
void RenderEngine::renderEndscreen() {
glClearColor(0.f, 0.f, 0.f, 0.25f);
glClear(GL_COLOR_BUFFER_BIT);
using FR = ghoul::fontrendering::FontRenderer;
using BBox = FR::BoundingBoxInformation;
BBox size = FR::defaultRenderer().boundingBox(
*_fontDate,
"Shutting down"
);
glm::vec2 penPosition = glm::vec2(
fontResolution().x / 2 - size.boundingBox.x / 2,
fontResolution().y / 2- size.boundingBox.y / 2
);
RenderFont(*_fontDate, penPosition, "Shutting down");
}
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
timer = std::max(timer, 0.f);