*
* 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
reshape_cube (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
reshape_cube (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
- glViewport (0, 0, (GLint) width, (GLint) height);
+ if (width > height * 2) { /* tiny window: show middle */
+ height = width;
+ y = -height/2;
+ h = height / (GLfloat) width;
+ }
+
+ glViewport (0, y, (GLint) width, (GLint) height);
- if (!ccs) {
- ccs = (cube_configuration *)
- calloc (MI_NUM_SCREENS(mi), sizeof (cube_configuration));
- if (!ccs) {
- fprintf(stderr, "%s: out of memory\n", progname);
- exit(1);
- }
- }
/* Set the size to roughly cover a 2x2 square on average. */
GLfloat scale = 1.8 / sqrt (cc->ncubes);
cube *cube = &cc->cubes[i];
/* Set the size to roughly cover a 2x2 square on average. */
GLfloat scale = 1.8 / sqrt (cc->ncubes);
cube *cube = &cc->cubes[i];
gltrackball_rotate (cc->trackball);
glRotatef (-180, 1, 0, 0);
gltrackball_rotate (cc->trackball);
glRotatef (-180, 1, 0, 0);
glScalef (s, s, s);
}
glRotatef (-90, 1, 0, 0);
glScalef (s, s, s);
}
glRotatef (-90, 1, 0, 0);