OpenGL ES, orthopgraphics projection and viewport

Posted by DarkDeny on Game Development See other posts from Game Development or by DarkDeny
Published on 2013-12-10T10:41:41Z Indexed on 2014/06/08 15:46 UTC
Read the original article Hit count: 242

Filed under:
|
|

I want to make some simple 2D game on iOS to familiarize myself with OpenGL ES. I started with Ray Wenderlich tutorial (How To Create A Simple 2D iPhone Game with OpenGL ES 2.0 and GLKit). That tutorial is quite good, but I miss some parts of a puzzle.

Ray creates orthographic projection using some magic numbers like 480 and 320. It is not clear to me why did he take these numbers, and as far as I can see - sprite is not mapped to the ipad simulator screen one-to-one pixel. I tried to play with parameters with which ortho matrix is created, but I cannot figure out what math is here.

How can I calculate numbers (bottom, top, left, right, close, far) which will be parameters to orthographic projection matrix creation and have sprite on the screen shown in its original size?

© Game Development or respective owner

Related posts about ios

Related posts about opengl-es2