Merge branch '7.8'
[mesa.git] / progs / xdemos / offset.c
index 0ad9147aea6d9be65775353a652189cf4198752e..3858a5b8020e8fd93e0814c4dff166df17c72e63 100644 (file)
@@ -47,7 +47,6 @@ PERFORMANCE OF THIS SOFTWARE.
 
 
 #include <GL/glx.h>
-#include <GL/glu.h>
 #include <X11/keysym.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -95,6 +94,9 @@ static int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
 
 static int dimension = 3;
 
+static float Scale = 1.0;
+
+
 int main(int argc, char** argv) {
     Display *dpy;
     XVisualInfo *vi;
@@ -135,7 +137,7 @@ int main(int argc, char** argv) {
 
     /* set up viewing parameters */
     glMatrixMode(GL_PROJECTION);
-    gluPerspective(20, 1, 10, 20);
+    glFrustum(-1, 1, -1, 1, 6, 20);
     glMatrixMode(GL_MODELVIEW);
     glTranslatef(0, 0, -15);
 
@@ -183,6 +185,7 @@ draw_scene(int mx, int my) {
 #else
     glEnable(GL_POLYGON_OFFSET_FILL);
 #endif
+    glScalef(Scale, Scale, Scale);
     cubes(mx, my, HIDDEN_LINE);
 #ifdef GL_EXT_polygon_offset
     glDisable(GL_POLYGON_OFFSET_EXT);
@@ -290,11 +293,18 @@ process_input(Display *dpy, Window win) {
        case KeyPress:
            (void) XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL);
            switch (keysym) {
+            case 'Z':
+               Scale *= 1.1;
+               break;
+            case 'z':
+               Scale *= 0.9;
+               break;
            case XK_Escape:
                exit(EXIT_SUCCESS);
            default:
                break;
            }
+           break;
        case ButtonPress:
            prevx = event.xbutton.x;
            prevy = event.xbutton.y;