Skip to content

Instantly share code, notes, and snippets.

@jcayzac
Created February 29, 2012 04:05
Show Gist options
  • Save jcayzac/1937575 to your computer and use it in GitHub Desktop.
Save jcayzac/1937575 to your computer and use it in GitHub Desktop.
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