From 92c57b739f3be89d3813dad3d50546a8aa5e03dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 30 Mar 2014 18:57:06 -0700 Subject: [PATCH] 01-cubes: fixed aspect ratio when window size changes. --- examples/01-cubes/cubes.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/01-cubes/cubes.cpp b/examples/01-cubes/cubes.cpp index bf9f628be..c1dab9b8b 100644 --- a/examples/01-cubes/cubes.cpp +++ b/examples/01-cubes/cubes.cpp @@ -173,18 +173,18 @@ int _main_(int /*_argc*/, char** /*_argv*/) float at[3] = { 0.0f, 0.0f, 0.0f }; float eye[3] = { 0.0f, 0.0f, -35.0f }; - float view[16]; - float proj[16]; - mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); - - // Set view and projection matrix for view 0. - bgfx::setViewTransform(0, view, proj); - int64_t timeOffset = bx::getHPCounter(); while (!entry::processEvents(width, height, debug, reset) ) { + float view[16]; + float proj[16]; + mtxLookAt(view, eye, at); + mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); + + // Set view and projection matrix for view 0. + bgfx::setViewTransform(0, view, proj); + // Set view 0 default viewport. bgfx::setViewRect(0, 0, 0, width, height);