mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:43:35 +02:00
DisplayPlugin::getLastSynchronizedElapsed
This commit is contained in:
parent
df413c0b14
commit
34de4d67d8
3 changed files with 11 additions and 0 deletions
|
@ -156,8 +156,10 @@ OpenGLDisplayPlugin::OpenGLDisplayPlugin() {
|
|||
_container->releaseOverlayTexture(texture);
|
||||
});
|
||||
|
||||
_synchronizedTimer.start();
|
||||
connect(&_timer, &QTimer::timeout, this, [&] {
|
||||
if (_active && _sceneTextureEscrow.depth() <= 1) {
|
||||
_synchronizedTimer.start();
|
||||
emit requestRender();
|
||||
}
|
||||
});
|
||||
|
@ -279,6 +281,10 @@ void OpenGLDisplayPlugin::submitOverlayTexture(GLuint sceneTexture, const glm::u
|
|||
}
|
||||
|
||||
void OpenGLDisplayPlugin::updateTextures() {
|
||||
const qint64 elapsed =_synchronizedTimer.elapsed();
|
||||
if (elapsed != 0) {
|
||||
_lastSynchronizedElapsed = elapsed;
|
||||
}
|
||||
_currentSceneTexture = _sceneTextureEscrow.fetchAndRelease(_currentSceneTexture);
|
||||
_currentOverlayTexture = _overlayTextureEscrow.fetchAndRelease(_currentOverlayTexture);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "DisplayPlugin.h"
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
#include <SimpleMovingAverage.h>
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
virtual void submitSceneTexture(uint32_t frameIndex, uint32_t sceneTexture, const glm::uvec2& sceneSize) override;
|
||||
virtual void submitOverlayTexture(uint32_t overlayTexture, const glm::uvec2& overlaySize) override;
|
||||
virtual float presentRate() override;
|
||||
virtual qint64 getLastSynchronizedElapsed() { return _lastSynchronizedElapsed; }
|
||||
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override {
|
||||
return getSurfacePixels();
|
||||
|
@ -68,6 +70,8 @@ protected:
|
|||
virtual void internalPresent();
|
||||
|
||||
mutable QTimer _timer;
|
||||
QElapsedTimer _synchronizedTimer;
|
||||
qint64 _lastSynchronizedElapsed { 0 };
|
||||
ProgramPtr _program;
|
||||
ShapeWrapperPtr _plane;
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
/// By default, all HMDs are stereo
|
||||
virtual bool isStereo() const { return isHmd(); }
|
||||
virtual bool isThrottled() const { return false; }
|
||||
virtual qint64 getLastSynchronizedElapsed() { return 0; }
|
||||
|
||||
// Rendering support
|
||||
|
||||
|
|
Loading…
Reference in a new issue