--- ray/src/hd/rhd_ogl.c 1998/12/21 11:42:38 3.3 +++ ray/src/hd/rhd_ogl.c 1998/12/21 15:31:49 3.5 @@ -162,8 +162,8 @@ char *id; #endif /* open display server */ ourdisplay = XOpenDisplay(NULL); - if (ourdisplay == NULL) - error(USER, "cannot open X-windows; DISPLAY variable set?\n"); + CHECK(ourdisplay==NULL, USER, + "cannot open X-windows; DISPLAY variable set?"); #ifdef STEREO switch (XSGIQueryStereoMode(ourdisplay, ourroot)) { case STEREO_TOP: @@ -171,7 +171,7 @@ char *id; break; case STEREO_OFF: error(USER, - "wrong video mode: run \"/usr/gfx/setmon -n STR_TOP\" first"); + "wrong video mode: run \"/usr/gfx/setmon -n STR_TOP\" first"); case X_STEREO_UNSUPPORTED: error(USER, "stereo mode not supported on this screen"); default: @@ -180,8 +180,7 @@ char *id; #endif /* find a usable visual */ ourvinf = glXChooseVisual(ourdisplay, ourscreen, atlBest); - if (ourvinf == NULL) - error(USER, "no suitable visuals available"); + CHECK(ourvinf==NULL, USER, "no suitable visuals available"); /* get a context */ gctx = glXCreateContext(ourdisplay, ourvinf, NULL, GL_TRUE); /* set gamma and tone mapping */ @@ -213,8 +212,7 @@ char *id; #endif BORWIDTH, ourvinf->depth, InputOutput, ourvinf->visual, CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &ourwinattr); - if (gwind == 0) - error(SYSTEM, "cannot create window\n"); + CHECK(gwind==0, SYSTEM, "cannot create window"); XStoreName(ourdisplay, gwind, id); /* set window manager hints */ ourxwmhints.flags = InputHint|IconPixmapHint; @@ -262,7 +260,7 @@ char *id; XMapWindow(ourdisplay, gwind); dev_input(); /* sets size and view angles */ if (!odInit(DisplayWidth(ourdisplay,ourscreen) * - DisplayHeight(ourdisplay,ourscreen) / 10)) + DisplayHeight(ourdisplay,ourscreen) / 4)) error(SYSTEM, "insufficient memory for value storage"); odev.name = id; odev.firstuse = 1; /* can't recycle samples */ @@ -363,6 +361,7 @@ char *gfn, *pfn; if (gfn == NULL) { gmEndGeom(); gmEndPortal(); + wipeclean(); /* new geometry, so redraw it */ return; } if (access(gfn, R_OK) == 0) @@ -463,16 +462,12 @@ dev_flush() /* flush output as appropriate */ gmDrawPortals(PORTRED, PORTGRN, PORTBLU, PORTALP); checkglerr("rendering base view"); } - if (mapped && viewsteady) { - if (isperspective) { /* first time after steady */ -#ifdef STEREO - pushright(); - popright(); -#endif + if (mapped && viewsteady) + if (isperspective > 0) { /* first time after steady */ if (ndrawn) xferdepth(); /* transfer and clear depth */ setglortho(); /* set orthographic view */ - } else { + } else if (!isperspective) { #ifdef STEREO pushright(); odUpdate(1); /* draw right eye */ @@ -480,7 +475,6 @@ dev_flush() /* flush output as appropriate */ #endif odUpdate(0); /* draw left eye */ } - } glFlush(); /* flush OpenGL */ rayqleft = RAYQLEN; /* flush X11 and return # pending */ @@ -514,8 +508,7 @@ xferdepth() /* load and clear depth buffer */ #endif depthbuffer = (GLfloat *)malloc( odev.hres*odev.vres*sizeof(GLfloat)); - if (depthbuffer == NULL) - error(SYSTEM, "out of memory in xferdepth"); + CHECK(depthbuffer==NULL, SYSTEM, "out of memory in xferdepth"); } /* allocate alpha buffer for portals */ if (gmPortals)