From 8bde679512056248f07af3290d0259a10f247d77 Mon Sep 17 00:00:00 2001 From: rkrolib Date: Thu, 9 Oct 2003 03:00:04 +0000 Subject: [PATCH] A few minor changes: * glutInit*() calls should preceed glutInit(), per se, generally. This is so that glutInit()'s configuration (which picks up on user parameters) can override application defaults. * glutInit() should be called before ANY attempt to process {argv, argc}. This is because there may be GLUT/freeglut parameters (such as "-display" on X11). * If the window is tall and skinny, rather than short and squat, we need to handle aspect ratios differently. The first is a user-interface bug. The second is a serious bug (especially since the demo assumes that argv[1] contains a filename). The third is a display bug. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@218 7f0cb862-5218-0410-a997-914c9d46530a --- .../freeglut/progs/demos/Fractals/fractals.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/freeglut/freeglut/progs/demos/Fractals/fractals.c b/freeglut/freeglut/progs/demos/Fractals/fractals.c index 3749f16..ee00245 100644 --- a/freeglut/freeglut/progs/demos/Fractals/fractals.c +++ b/freeglut/freeglut/progs/demos/Fractals/fractals.c @@ -83,7 +83,7 @@ static void draw_level ( int num, double m00, double m01, double m10, double m11 static void Display(void) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear( GL_COLOR_BUFFER_BIT ); /* the curve */ glPushMatrix(); @@ -106,7 +106,10 @@ Reshape(int width, int height) glMatrixMode ( GL_PROJECTION ) ; glLoadIdentity(); ar = (float) width / (float) height ; - glFrustum ( -ar, ar, -1.0, 1.0, 2.0, 100.0 ) ; + if( ar > 1 ) + glFrustum ( -ar, ar, -1.0, 1.0, 2.0, 100.0 ) ; + else + glFrustum ( -1.0, 1.0, -1/ar, 1/ar, 2.0, 100.0 ); glMatrixMode ( GL_MODELVIEW ) ; glLoadIdentity () ; xwin = -1.0 ; @@ -259,17 +262,16 @@ main(int argc, char *argv[]) { int fractal_window ; + glutInitWindowSize(500, 250); + glutInitWindowPosition ( 140, 140 ); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE ); + glutInit(&argc, argv); + if ( argc > 1 ) readConfigFile ( argv[1] ) ; else readConfigFile ( "fractals.dat" ) ; - glutInit(&argc, argv); - glutInitWindowSize(500, 250); - glutInitWindowPosition ( 140, 140 ) ; - - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - fractal_window = glutCreateWindow( window_title ); glClearColor(1.0, 1.0, 1.0, 1.0);