From http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz
[xscreensaver] / hacks / glx / rubikblocks.c
index 9a6ecbdc06ae4794f0b4971ef326e5c09e40bebb..fadeb0d07c5ca5ef614be77d13caa3bb696be011 100644 (file)
@@ -22,7 +22,7 @@
                    "*wireframe:     False         \n" \
                   "*suppressRotationAnimation: True\n" \
 
-# define refresh_rubikblocks 0
+# define free_rubikblocks 0
 # define release_rubikblocks 0
 #include "xlockmore.h"
 #include "rotator.h"
@@ -496,8 +496,8 @@ init_gl(ModeInfo *mi)
       0, GL_LUMINANCE, GL_UNSIGNED_BYTE, cp->texture);
 #endif  
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
-  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 #ifdef MIPMAP
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
@@ -542,9 +542,15 @@ ENTRYPOINT void
 reshape_rubikblocks(ModeInfo *mi, int width, int height) 
 {
   rubikblocks_conf *cp = &rubikblocks[MI_SCREEN(mi)];
+  int y = 0;
+
+  if (width > height * 5) {   /* tiny window: show middle */
+    height = width;
+    y = -height/2;
+  }
   if(!height) height = 1;
   cp->ratio = (GLfloat)width/(GLfloat)height;
-  glViewport(0, 0, (GLint) width, (GLint) height);
+  glViewport(0, y, (GLint) width, (GLint) height);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   gluPerspective(30.0, cp->ratio, 1.0, 100.0);
@@ -556,7 +562,7 @@ ENTRYPOINT void
 init_rubikblocks(ModeInfo *mi) 
 {
   rubikblocks_conf *cp;
-  MI_INIT(mi, rubikblocks, NULL);
+  MI_INIT(mi, rubikblocks);
   cp = &rubikblocks[MI_SCREEN(mi)];
 
   if(tex)