diff --git a/examples/01-cubes/cubes.cpp b/examples/01-cubes/cubes.cpp index 4a7f4a395..84569dc66 100644 --- a/examples/01-cubes/cubes.cpp +++ b/examples/01-cubes/cubes.cpp @@ -179,7 +179,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/02-metaballs/metaballs.cpp b/examples/02-metaballs/metaballs.cpp index 217abe5bf..f4904aec3 100644 --- a/examples/02-metaballs/metaballs.cpp +++ b/examples/02-metaballs/metaballs.cpp @@ -556,7 +556,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/03-raymarch/raymarch.cpp b/examples/03-raymarch/raymarch.cpp index 92c35c455..39cef6971 100644 --- a/examples/03-raymarch/raymarch.cpp +++ b/examples/03-raymarch/raymarch.cpp @@ -266,7 +266,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); // Set view and projection matrix for view 1. bgfx::setViewTransform(0, view, proj); diff --git a/examples/04-mesh/mesh.cpp b/examples/04-mesh/mesh.cpp index a4ee84ad9..0503ef1da 100644 --- a/examples/04-mesh/mesh.cpp +++ b/examples/04-mesh/mesh.cpp @@ -364,7 +364,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/05-instancing/instancing.cpp b/examples/05-instancing/instancing.cpp index fdec886fb..2fec00e88 100644 --- a/examples/05-instancing/instancing.cpp +++ b/examples/05-instancing/instancing.cpp @@ -204,7 +204,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/06-bump/bump.cpp b/examples/06-bump/bump.cpp index 3880fc807..857006f75 100644 --- a/examples/06-bump/bump.cpp +++ b/examples/06-bump/bump.cpp @@ -381,7 +381,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); float lightPosRadius[4][4]; for (uint32_t ii = 0; ii < numLights; ++ii) diff --git a/examples/07-callback/callback.cpp b/examples/07-callback/callback.cpp index 0739da96e..63db39784 100644 --- a/examples/07-callback/callback.cpp +++ b/examples/07-callback/callback.cpp @@ -259,8 +259,11 @@ int _main_(int /*_argc*/, char** /*_argv*/) { BgfxCallback callback; + uint32_t width = 1280; + uint32_t height = 720; + bgfx::init(&callback); - bgfx::reset(1280, 720, BGFX_RESET_CAPTURE); + bgfx::reset(width, height, BGFX_RESET_CAPTURE); // Enable debug text. bgfx::setDebug(BGFX_DEBUG_TEXT); @@ -362,7 +365,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/08-update/update.cpp b/examples/08-update/update.cpp index 06ce0f3d9..23d099c7a 100644 --- a/examples/08-update/update.cpp +++ b/examples/08-update/update.cpp @@ -309,7 +309,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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); diff --git a/examples/09-hdr/hdr.cpp b/examples/09-hdr/hdr.cpp index 8922e8e93..7f4a5fab7 100644 --- a/examples/09-hdr/hdr.cpp +++ b/examples/09-hdr/hdr.cpp @@ -640,7 +640,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) vec3MulMtx(temp, eye, mtx); mtxLookAt(view, temp, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); // Set view and projection matrix for view 1. bgfx::setViewTransformMask(1<<1, view, proj); diff --git a/examples/12-lod/lod.cpp b/examples/12-lod/lod.cpp index eb4765ae2..f8763f507 100644 --- a/examples/12-lod/lod.cpp +++ b/examples/12-lod/lod.cpp @@ -457,7 +457,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f); + 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);