X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fcube21.c;h=451a5239ddb1cb232326e52479700f979ceea8bf;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=0cfd2123f62d80091a42030feaa9293f40b676b2;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba;p=xscreensaver diff --git a/hacks/glx/cube21.c b/hacks/glx/cube21.c index 0cfd2123..451a5239 100644 --- a/hacks/glx/cube21.c +++ b/hacks/glx/cube21.c @@ -45,7 +45,7 @@ "*showFPS: False \n" \ "*wireframe: False \n" -# define refresh_cube21 0 +# define free_cube21 0 # define release_cube21 0 #include "xlockmore.h" @@ -764,8 +764,8 @@ static void 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); @@ -846,9 +846,18 @@ static void init_cp(cube21_conf *cp) ENTRYPOINT void reshape_cube21(ModeInfo *mi, int width, int height) { cube21_conf *cp = &cube21[MI_SCREEN(mi)]; + int y = 0; if(!height) height = 1; cp->ratio = (GLfloat)width/(GLfloat)height; - glViewport(0, 0, (GLint) width, (GLint) height); + + if (width > height * 5) { /* tiny window: show middle */ + height = width; + y = -height/2; + cp->ratio = width / (GLfloat) height; + cp->posarg = 0; + } + + glViewport(0, y, (GLint) width, (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.0, cp->ratio, 1.0, 100.0); @@ -873,7 +882,7 @@ cube21_handle_event (ModeInfo *mi, XEvent *event) ENTRYPOINT void init_cube21(ModeInfo *mi) { cube21_conf *cp; - MI_INIT(mi, cube21, NULL); + MI_INIT(mi, cube21); cp = &cube21[MI_SCREEN(mi)]; cp->trackball = gltrackball_init (False);