Created
December 1, 2012 06:56
-
-
Save tuttlem/4180890 to your computer and use it in GitHub Desktop.
OpenGL2D - setup
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
/* first of all, we need to read the dimensions of the | |
display viewport. */ | |
int viewport[4]; | |
glGetIntegerv(GL_VIEWPORT, viewport); | |
/* setup an orthographic matrix using the viewport | |
dimensions on the projection matrix */ | |
glMatrixMode(GL_PROJECTION); | |
glLoadIdentity(); | |
glOrtho(0, viewport[2], viewport[3], 0, -1, 1); | |
/* clear out the modelview matrix */ | |
glMatrixMode(GL_MODELVIEW); | |
glLoadIdentity(); | |
/* disable depth testing (as we're not using z) */ | |
glDisable(GL_DEPTH_TEST); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment