mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 12:59:07 -06:00
Render text informing of ongoing shutdown (#696)
This commit is contained in:
@@ -93,6 +93,7 @@ public:
|
||||
bool mouseActivationCallback(const glm::dvec2& mousePosition) const;
|
||||
|
||||
void renderOverlays(const ShutdownInformation& shutdownInfo);
|
||||
void renderEndscreen();
|
||||
void postDraw();
|
||||
|
||||
// Performance measurements
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user