projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.26.tar.gz
[xscreensaver]
/
hacks
/
glx
/
boing.c
diff --git
a/hacks/glx/boing.c
b/hacks/glx/boing.c
index 21b1958054bdaf10f9b7561488e4b55ceb877e9c..3396217ffeabe84c5fe0b091722734d93d154c7b 100644
(file)
--- a/
hacks/glx/boing.c
+++ b/
hacks/glx/boing.c
@@
-1,4
+1,4
@@
-/* boing, Copyright (c) 2005-20
08
Jamie Zawinski <jwz@jwz.org>
+/* boing, Copyright (c) 2005-20
12
Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-378,7
+378,7
@@
draw_scanlines (ModeInfo *mi)
int lh, ls;
int y;
glLoadIdentity();
int lh, ls;
int y;
glLoadIdentity();
- gl
uOrtho2D (0, w, 0, h
);
+ gl
Ortho (0, w, 0, h, -1, 1
);
if (h > 500) lh = 4, ls = 4;
else if (h > 300) lh = 2, ls = 1;
if (h > 500) lh = 4, ls = 4;
else if (h > 300) lh = 2, ls = 1;
@@
-461,6
+461,13
@@
reshape_boing (ModeInfo *mi, int width, int height)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
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);
gluPerspective (8.0, 1/h, 1.0, 10.0);
glMatrixMode(GL_MODELVIEW);
@@
-629,6
+636,18
@@
draw_boing (ModeInfo *mi)
tick_physics (mi);
glPushMatrix ();
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);
gltrackball_rotate (bp->trackball);
glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);