X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fboing.c;h=3396217ffeabe84c5fe0b091722734d93d154c7b;hb=3f1091236d800c43a3124c44c7da54e53f205b13;hp=1c95d1ead8c269a244ca622049cabbe28ec0134a;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/glx/boing.c b/hacks/glx/boing.c index 1c95d1ea..3396217f 100644 --- a/hacks/glx/boing.c +++ b/hacks/glx/boing.c @@ -1,4 +1,4 @@ -/* boing, Copyright (c) 2005-2008 Jamie Zawinski +/* boing, Copyright (c) 2005-2012 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -109,6 +109,8 @@ static XrmOptionDescRec opts[] = { { "-ball-color2",".ballColor2",XrmoptionSepArg, 0 }, { "-grid-color", ".gridColor", XrmoptionSepArg, 0 }, { "-shadow-color",".shadowColor",XrmoptionSepArg, 0 }, + { "-background", ".boingBackground",XrmoptionSepArg, 0 }, + { "-bg", ".boingBackground",XrmoptionSepArg, 0 }, }; static argtype vars[] = { @@ -376,7 +378,7 @@ draw_scanlines (ModeInfo *mi) int lh, ls; int y; glLoadIdentity(); - gluOrtho2D (0, w, 0, h); + glOrtho (0, w, 0, h, -1, 1); if (h > 500) lh = 4, ls = 4; else if (h > 300) lh = 2, ls = 1; @@ -459,6 +461,13 @@ reshape_boing (ModeInfo *mi, int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); + + if (height > width) + { + GLfloat s = width / (GLfloat) height; + glScalef (s, s, s); + } + gluPerspective (8.0, 1/h, 1.0, 10.0); glMatrixMode(GL_MODELVIEW); @@ -627,6 +636,18 @@ draw_boing (ModeInfo *mi) tick_physics (mi); glPushMatrix (); + + { + double rot = current_device_rotation(); + glRotatef(rot, 0, 0, 1); + if ((rot > 45 && rot < 135) || + (rot < -45 && rot > -135)) + { + GLfloat s = MI_WIDTH(mi) / (GLfloat) MI_HEIGHT(mi); + glScalef (1/s, s, 1); + } + } + gltrackball_rotate (bp->trackball); glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);