Fixing update time.

This commit is contained in:
bkaradzic 2013-04-27 00:11:23 -07:00
parent 8711d3d3a3
commit 9780828b98
2 changed files with 7 additions and 3 deletions
examples
01-cubes
06-bump

View file

@ -183,6 +183,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -199,14 +201,14 @@ int _main_(int /*_argc*/, char** /*_argv*/)
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();
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/01-cube");
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Rendering simple static mesh.");
bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs);
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
// Submit 11x11 cubes.
for (uint32_t yy = 0; yy < 11; ++yy)
{

View file

@ -348,6 +348,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
mem = loadTexture("fieldstone-n.dds");
bgfx::TextureHandle textureNormal = bgfx::createTexture(mem);
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -364,7 +366,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
const double freq = double(bx::getHPFrequency() );
const double toMs = 1000.0/freq;
float time = (float)(now/freq);
float time = (float)( (now-timeOffset)/freq);
// Use debug font to print information about this example.
bgfx::dbgTextClear();