X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fboing.c;h=3396217ffeabe84c5fe0b091722734d93d154c7b;hb=c141c2b05e374757b6499d12bb8a6d4d943b1529;hp=979907210a19beacc86b0ad42d38e4c578ba1326;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/hacks/glx/boing.c b/hacks/glx/boing.c index 97990721..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 @@ -461,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); @@ -629,8 +636,19 @@ 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); - glRotatef(current_device_rotation(), 0, 0, 1); glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);