From 73c793c0a17bb03191fabc2edcced206d4450669 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Wed, 15 May 2013 09:37:36 -0700 Subject: [PATCH] Added optional millisecond onscreen frame timer for easier latency timing with high-speed camera --- interface/src/Application.cpp | 14 ++++++++++++++ interface/src/Application.h | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 146d4a30c3..acf11fba0a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1085,6 +1085,9 @@ void Application::initMenu() { _renderAtmosphereOn->setShortcut(Qt::SHIFT | Qt::Key_A); (_renderAvatarsOn = renderMenu->addAction("Avatars"))->setCheckable(true); _renderAvatarsOn->setChecked(true); + (_renderFrameTimerOn = renderMenu->addAction("Show Timer"))->setCheckable(true); + _renderFrameTimerOn->setChecked(false); + renderMenu->addAction("First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P)->setCheckable(true); (_oculusOn = renderMenu->addAction("Oculus", this, SLOT(setOculus(bool)), Qt::Key_O))->setCheckable(true); @@ -1629,6 +1632,17 @@ void Application::displayOverlay() { if (_chatEntryOn) { _chatEntry.render(_glWidget->width(), _glWidget->height()); } + + // Show on-screen msec timer + if (_renderFrameTimerOn->isChecked()) { + char frameTimer[10]; + double mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5); + mSecsNow = mSecsNow - floor(mSecsNow / 1000.0) * 1000.0; + sprintf(frameTimer, "%3.0f\n", mSecsNow); + drawtext(_glWidget->width() - 100, _glWidget->height() - 20, 0.30, 0, 1.0, 0, frameTimer, 0, 0, 0); + drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30, 0, 1.0, 0, frameTimer, 1, 1, 1); + } + // Stats at upper right of screen about who domain server is telling us about glPointSize(1.0f); diff --git a/interface/src/Application.h b/interface/src/Application.h index f9b46be889..1500ceb850 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -134,8 +134,9 @@ private: QAction* _renderAtmosphereOn; // Whether to display the atmosphere QAction* _renderAvatarsOn; // Whether to render avatars QAction* _oculusOn; // Whether to configure the display for the Oculus Rift - QAction* _renderStatsOn; // Whether to show onscreen text overlay with stats - QAction* _logOn; // Whether to show on-screen log + QAction* _renderStatsOn; // Whether to show onscreen text overlay with stats + QAction* _renderFrameTimerOn; // Whether to show onscreen text overlay with stats + QAction* _logOn; // Whether to show on-screen log QAction* _voxelPaintColor; // The color with which to paint voxels QAction* _frustumOn; // Whether or not to display the debug view frustum QAction* _viewFrustumFromOffset; // Whether or not to offset the view of the frustum