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.38.tar.gz
[xscreensaver]
/
hacks
/
glx
/
tangram.c
diff --git
a/hacks/glx/tangram.c
b/hacks/glx/tangram.c
index 8fab0493efbbf2f903d61718900dd1db5a4c3ad6..c250f5455ea6d7176d91fdd037c21a870f2a70c2 100644
(file)
--- a/
hacks/glx/tangram.c
+++ b/
hacks/glx/tangram.c
@@
-22,7
+22,7
@@
"*titleFont2: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-*-*\n" \
"*titleFont3: -*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*\n" \
"*titleFont2: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-*-*\n" \
"*titleFont3: -*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*\n" \
-# define
refresh
_tangram 0
+# define
free
_tangram 0
# define release_tangram 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
# define release_tangram 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
@@
-742,6
+742,15
@@
static void draw_shapes(ModeInfo * mi)
{
tangram_configuration *tp = &tps[MI_SCREEN(mi)];
{
tangram_configuration *tp = &tps[MI_SCREEN(mi)];
+# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
+ {
+ GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
+ int o = (int) current_device_rotation();
+ if (o != 0 && o != 180 && o != -180)
+ glScalef (h, 1/h, 1);
+ }
+# endif
+
draw_tangram_shape(tp->tsm1);
draw_tangram_shape(tp->tsm2);
draw_tangram_shape(tp->tsm1);
draw_tangram_shape(tp->tsm2);
@@
-768,23
+777,16
@@
static void draw_shapes(ModeInfo * mi)
}
}
}
}
-
static void set_perspective(void
)
+
ENTRYPOINT void reshape_tangram(ModeInfo * mi, int w, int h
)
{
{
- glPushMatrix();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60, -1, 0.1, 50);
- gluLookAt(0, 5, -5, 0, 0, 0, 0, -1, 0);
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ int y = 0;
-}
+ if (w > h * 5) { /* tiny window: show middle */
+ h = w;
+ y = -h/2;
+ }
-ENTRYPOINT void reshape_tangram(ModeInfo * mi, int w, int h)
-{
- glViewport(0, 0, w, h);
- set_perspective();
- glLoadIdentity();
+ glViewport(0, y, w, h);
}
static void set_camera(tangram_configuration *tp)
}
static void set_camera(tangram_configuration *tp)
@@
-882,14
+884,7
@@
ENTRYPOINT void init_tangram(ModeInfo * mi)
{
tangram_configuration *tp;
{
tangram_configuration *tp;
- if (!tps) {
- tps = (tangram_configuration *)
- calloc(MI_NUM_SCREENS(mi), sizeof(tangram_configuration));
- if (!tps) {
- fprintf(stderr, "%s: out of memory\n", progname);
- exit(1);
- }
- }
+ MI_INIT (mi, tps);
tp = &tps[MI_SCREEN(mi)];
tp = &tps[MI_SCREEN(mi)];