mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-23 05:19:18 -06:00
Only enable syncing after the first frame due to high initialization load
This commit is contained in:
@@ -172,6 +172,10 @@ private:
|
||||
// The current state of the countdown; if it reaches '0', the application will close
|
||||
float _shutdownCountdown;
|
||||
|
||||
// The first frame might take some more time in the update loop, so we need to know to
|
||||
// disable the synchronization; otherwise a hardware sync will kill us after 1 sec
|
||||
bool _isFirstRenderingFirstFrame;
|
||||
|
||||
static OpenSpaceEngine* _engine;
|
||||
};
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
, _isInShutdownMode(false)
|
||||
, _shutdownCountdown(0.f)
|
||||
, _shutdownWait(0.f)
|
||||
, _isFirstRenderingFirstFrame(true)
|
||||
{
|
||||
_interactionHandler->setPropertyOwner(_globalPropertyNamespace.get());
|
||||
_globalPropertyNamespace->addPropertySubOwner(_interactionHandler.get());
|
||||
@@ -837,6 +838,10 @@ void OpenSpaceEngine::setRunTime(double d){
|
||||
|
||||
void OpenSpaceEngine::preSynchronization() {
|
||||
FileSys.triggerFilesystemEvents();
|
||||
|
||||
if (_isFirstRenderingFirstFrame) {
|
||||
_windowWrapper->setSynchronization(false);
|
||||
}
|
||||
|
||||
_syncEngine->presync(_isMaster);
|
||||
if (_isMaster) {
|
||||
@@ -949,8 +954,15 @@ void OpenSpaceEngine::postDraw() {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_isInShutdownMode)
|
||||
if (_isInShutdownMode) {
|
||||
_renderEngine->renderShutdownInformation(_shutdownCountdown, _shutdownWait);
|
||||
}
|
||||
|
||||
if (_isFirstRenderingFirstFrame) {
|
||||
_windowWrapper->setSynchronization(true);
|
||||
_isFirstRenderingFirstFrame = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction action) {
|
||||
|
||||
Reference in New Issue
Block a user