--- ray/src/hd/rhd_glx.c 1998/01/01 13:00:15 3.10 +++ ray/src/hd/rhd_glx.c 1998/01/06 13:07:57 3.15 @@ -94,11 +94,13 @@ dev_open(id) /* initialize X11 driver */ char *id; { extern char *getenv(); + static RGBPRIMS myprims = STDPRIMS; static int atlBest[] = {GLX_RGBA, GLX_RED_SIZE,8, GLX_GREEN_SIZE,8, GLX_BLUE_SIZE,8, GLX_DEPTH_SIZE,15, None}; - char *gv; + char *ev; double gamval = GAMMA; + RGBPRIMP dpri = stdprims; XSetWindowAttributes ourwinattr; XWMHints ourxwmhints; XSizeHints oursizhints; @@ -116,10 +118,17 @@ char *id; /* get a context */ gctx = glXCreateContext(ourdisplay, ourvinf, NULL, GL_TRUE); /* set gamma and tone mapping */ - if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL - || (gv = getenv("DISPLAY_GAMMA")) != NULL) - gamval = atof(gv); - if (tmInit(mytmflags(), stdprims, gamval) == NULL) + if ((ev = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL + || (ev = getenv("DISPLAY_GAMMA")) != NULL) + gamval = atof(ev); + if ((ev = getenv("DISPLAY_PRIMARIES")) != NULL && + sscanf(ev, "%f %f %f %f %f %f %f %f", + &myprims[RED][CIEX],&myprims[RED][CIEY], + &myprims[GRN][CIEX],&myprims[GRN][CIEY], + &myprims[BLU][CIEX],&myprims[BLU][CIEY], + &myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) + dpri = myprims; + if (tmInit(mytmflags(), dpri, gamval) == NULL) error(SYSTEM, "not enough memory in dev_open"); /* open window */ ourwinattr.background_pixel = ourblack; @@ -168,8 +177,8 @@ char *id; dev_input(); /* sets size and view angles */ /* allocate our leaf pile */ if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * - DisplayHeight(ourdisplay,ourscreen) / - (qtMinNodesiz*qtMinNodesiz))) + DisplayHeight(ourdisplay,ourscreen) * 3 / + (qtMinNodesiz*qtMinNodesiz*2))) error(SYSTEM, "insufficient memory for value storage"); odev.name = id; odev.ifd = ConnectionNumber(ourdisplay); @@ -195,6 +204,14 @@ dev_close() /* close our display and free resources } +dev_clear() /* clear our quadtree */ +{ + qtCompost(100); + glClear(GL_DEPTH_BUFFER_BIT); + rayqleft = 0; /* hold off update */ +} + + int dev_view(nv) /* assign new driver view */ register VIEW *nv; @@ -278,6 +295,9 @@ double rad; { register int ci, j; double apexh, basez; + /* is window mapped? */ + if (!mapped) + return; /* compute apex height (0. to 1.) */ if (ip[2] > 1e6) apexh = 1. - 1./DEPTHFACT; @@ -591,6 +611,7 @@ register XKeyPressedEvent *ekey; glFlush(); qtCompost(100); /* get rid of old values */ inpresflags |= DFL(DC_REDRAW); /* resend values from server */ + rayqleft = 0; /* hold off update */ return; case 'K': /* kill rtrace process(es) */ inpresflags |= DFL(DC_KILL);