Created
February 29, 2012 04:05
-
-
Save jcayzac/1937575 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGRect frame = self.frame; | |
float aspect = frame.size.height/frame.size.width; | |
// Assuming: | |
// - the phone is held 30cm away from the eye, | |
float near = 0.3f; | |
// - objects farther than 10Km aren't shown, | |
float far = 10000.f; | |
// iPhone4S: | |
// http://stackoverflow.com/questions/3594199/iphone-4-camera-specifications-field-of-view-vertical-horizontal-angle | |
// In portrait mode, horizontal angle is 47.5 degrees | |
// In landspace mode, horizontal angle is 60.8 degrees | |
// We only support portrait in this prototype | |
float angle = (float)(47.5*M_PI/180.0); | |
Matrix4 projection_matrix = CreatePerspectiveMatrix(near, far, angle, aspect); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment