From 2f1a49e335837bdb03b5ce7818d83989c743935a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 Jan 2010 13:46:53 -0700 Subject: [PATCH] progs/xdemos: add z/Z keys for scaling the rendering --- progs/xdemos/offset.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c index 314a4fcdd17..3858a5b8020 100644 --- a/progs/xdemos/offset.c +++ b/progs/xdemos/offset.c @@ -94,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; @@ -182,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); @@ -289,6 +293,12 @@ 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: -- 2.30.2