mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-04-01 01:51:46 -04:00
Fixing update time.
This commit is contained in:
parent
8711d3d3a3
commit
9780828b98
2 changed files with 7 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue