iOS: Fixed aspect ratio in examples.

This commit is contained in:
bkaradzic 2013-07-22 21:24:20 -07:00
parent 5707309e6f
commit 538796302f
10 changed files with 14 additions and 11 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);