X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fblinkbox.c;h=ba4693815f6d474d64d0eb54881267fae92eb4ac;hb=refs%2Fheads%2Fmaster2;hp=23b2643783a2e4d9db47903f50072f7af6d043a8;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/glx/blinkbox.c b/hacks/glx/blinkbox.c index 23b26437..ba469381 100644 --- a/hacks/glx/blinkbox.c +++ b/hacks/glx/blinkbox.c @@ -14,6 +14,7 @@ #define DEFAULTS "*delay: 30000 \n" \ "*wireframe: False \n" \ + "*suppressRotationAnimation: True\n" \ # define refresh_ball 0 # define release_ball 0 @@ -31,7 +32,7 @@ #define ALPHA_AMT 0.05 /* this should be between 1 and 8 */ -#define DEF_WH "2" +#define DEF_BOXSIZE "2" #define DEF_DISSOLVE "False" #define DEF_FADE "True" #define DEF_BLUR "True" @@ -121,7 +122,7 @@ static XrmOptionDescRec opts[] = { }; static argtype vars[] = { - {&bscale_wh, "boxsize", "Boxsize", DEF_WH, t_Float}, + {&bscale_wh, "boxsize", "Boxsize", DEF_BOXSIZE, t_Float}, {&do_dissolve, "dissolve", "Dissolve", DEF_DISSOLVE, t_Bool}, {&do_fade, "fade", "Fade", DEF_FADE, t_Bool}, {&do_blur, "blur", "Blur", DEF_BLUR, t_Bool}, @@ -151,7 +152,7 @@ swap_mov(GLfloat *a, GLfloat *b) swap(a,b); j = get_rand(); if (*a < 0) - *a = (j *= -1); + *a = j * -1; else *a = j; } @@ -243,6 +244,13 @@ reshape_ball (ModeInfo *mi, int width, int height) 0.0, 0.0, 0.0, 0.0, 2.0, 10.0); +# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */ + { + int o = (int) current_device_rotation(); + if (o != 0 && o != 180 && o != -180) + glScalef (1/h, 1/h, 1/h); + } +# endif } static void @@ -386,8 +394,6 @@ init_ball (ModeInfo *mi) bp->des_amt = bp->bscale.wh / MAX_COUNT; } - bp->glx_context = init_GL(mi); - reshape_ball(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); bp->ballList = glGenLists(1); glNewList(bp->ballList, GL_COMPILE); @@ -403,7 +409,6 @@ init_ball (ModeInfo *mi) glEnable(GL_COLOR_MATERIAL); glShadeModel(GL_SMOOTH); - glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -440,6 +445,7 @@ draw_ball (ModeInfo *mi) if (! bp->glx_context) return; + mi->polygon_count = 0; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context)); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -466,6 +472,7 @@ draw_ball (ModeInfo *mi) glScalef(2,2,2); glCallList(bp->ballList); + mi->polygon_count += SPHERE_SLICES*SPHERE_STACKS; } else { @@ -487,6 +494,7 @@ draw_ball (ModeInfo *mi) glScalef(2, 2, 2); glCallList(bp->ballList); + mi->polygon_count += SPHERE_SLICES*SPHERE_STACKS; glScalef(.5, .5, .5); } i = 0; @@ -571,6 +579,7 @@ draw_ball (ModeInfo *mi) glScalef(bp->bscale.wh,bp->bscale.wh,bp->bscale.d); } glCallList(bp->boxList); + mi->polygon_count += 6; glPopMatrix(); bp->sp->counter--; bp->sp->des_count++; @@ -585,6 +594,7 @@ draw_ball (ModeInfo *mi) glPopMatrix(); + if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(dpy, window);