- struct timeval tv;
- tv.tv_sec = usecs / 1000000L;
- tv.tv_usec = usecs % 1000000L;
- (void) select (0, 0, 0, 0, &tv);
+ GLfloat h = (GLfloat) height / (GLfloat) width;
+
+ glViewport(0, 0, (GLint) width, (GLint) height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -40.0);
+}
+
+
+ENTRYPOINT void
+init_stonerview (ModeInfo *mi)
+{
+ stonerview_configuration *bp;
+
+ if (!bps) {
+ bps = (stonerview_configuration *)
+ calloc (MI_NUM_SCREENS(mi), sizeof (stonerview_configuration));
+ if (!bps) {
+ fprintf(stderr, "%s: out of memory\n", progname);
+ exit(1);
+ }
+ }
+
+ bp = &bps[MI_SCREEN(mi)];
+
+ bp->glx_context = init_GL(mi);
+
+ bp->trackball = gltrackball_init ();
+ bp->st = init_view(MI_IS_WIREFRAME(mi), transparent_p);
+ init_move(bp->st);
+
+ reshape_stonerview (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+ clear_gl_error(); /* WTF? sometimes "invalid op" from glViewport! */