diff options
Diffstat (limited to 'progs/trivial/tri.c')
-rw-r--r-- | progs/trivial/tri.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c index d3c6b59ea5..d99d5872a9 100644 --- a/progs/trivial/tri.c +++ b/progs/trivial/tri.c @@ -41,28 +41,28 @@ static void Init(void) fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - glClearColor(0.3, 0.1, 0.3, 0.0); + glClearColor(0.3, 0.1, 0.3, 0.0); } static void Reshape(int width, int height) { - glViewport(0, 0, (GLint)width, (GLint)height); + glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); } static void Key(unsigned char key, int x, int y) { switch (key) { - case 27: - exit(0); - default: - glutPostRedisplay(); - return; + case 27: + exit(0); + default: + glutPostRedisplay(); + return; } } @@ -88,47 +88,47 @@ static void Draw(void) static GLenum Args(int argc, char **argv) { - GLint i; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; + GLint i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; } int main(int argc, char **argv) { - GLenum type; + GLenum type; - glutInit(&argc, argv); + glutInit(&argc, argv); - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); + type = GLUT_RGB | GLUT_ALPHA; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); - win = glutCreateWindow("First Tri"); - if (!win) { - exit(1); - } + win = glutCreateWindow(*argv); + if (!win) { + exit(1); + } - Init(); + Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; } |