Skip to content

Instantly share code, notes, and snippets.

@akio0911
Created May 13, 2009 02:44
Show Gist options
  • Save akio0911/110842 to your computer and use it in GitHub Desktop.
Save akio0911/110842 to your computer and use it in GitHub Desktop.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
const CGFloat NEAR = 0.1f;
const CGFloat FAR = 10.0f;
const CGFloat FOVY = 90.0f;
const CGFloat ASPECT = backingWidth / backingHeight;
CGFloat scale = NEAR * tan(FOVY * 0.5f * M_PI / 180.0f);
CGFloat x = scale * ASPECT;
CGFloat y = scale;
glFrustumf(-x, x, -y, y, NEAR, FAR);
glViewport(0, 0, backingWidth, backingHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment