Fixing update time.

This commit is contained in:
bkaradzic 2013-04-27 12:43:18 -07:00
parent 9780828b98
commit 3686725fef
3 changed files with 9 additions and 6 deletions

View File

@ -572,6 +572,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
const uint32_t zpitch = DIMS*DIMS;
const float invdim = 1.0f/float(DIMS-1);
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -587,6 +589,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
last = now;
const double freq = double(bx::getHPFrequency() );
const double toMs = 1000.0/freq;
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
// Use debug font to print information about this example.
bgfx::dbgTextClear();
@ -604,8 +607,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
// Stats.
uint32_t numVertices = 0;
int64_t profUpdate = 0;

View File

@ -172,6 +172,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::destroyVertexShader(vsh);
bgfx::destroyFragmentShader(fsh);
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -187,6 +189,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
last = now;
const double freq = double(bx::getHPFrequency() );
const double toMs = 1000.0/freq;
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
// Use debug font to print information about this example.
bgfx::dbgTextClear();
@ -205,8 +208,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
const uint16_t instanceStride = 80;
const bgfx::InstanceDataBuffer* idb = bgfx::allocInstanceDataBuffer(121, instanceStride);
if (NULL != idb)

View File

@ -228,6 +228,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
uint32_t miss = 0;
std::list<PackCube> quads;
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -243,6 +245,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
last = now;
const int64_t freq = bx::getHPFrequency();
const double toMs = 1000.0/double(freq);
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
// Use debug font to print information about this example.
bgfx::dbgTextClear();
@ -310,8 +313,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
float mtx[16];
mtxRotateXY(mtx, time, time*0.37f);