- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix\r
- glLoadIdentity(); // Reset The Modelview Matrix\r
+ glMatrixMode(GL_PROJECTION); /* switch matrix mode*/\r
+ glLoadIdentity();\r
+\r
+ if (w <= h) {\r
+ gluOrtho2D(-n, n, -n * aspect, n * aspect);\r
+ } else {\r
+ gluOrtho2D(-n * aspect, n * aspect, -n, n);\r
+ }\r
+\r
+ glMatrixMode(GL_MODELVIEW); /* return to modelview mode */\r