--- ray/src/util/glrad.c 1998/06/10 17:52:18 3.4 +++ ray/src/util/glrad.c 1998/10/15 08:30:48 3.10 @@ -33,9 +33,6 @@ static char SCCSid[] = "$SunId$ SGI"; #define MOVDEG (-5) /* degrees to orbit CW/down /frame */ #define MOVORB(s) ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0) -#define MINWIDTH 480 /* minimum graphics window width */ -#define MINHEIGHT 400 /* minimum graphics window height */ - #define BORWIDTH 5 /* border width */ #define ourscreen DefaultScreen(ourdisplay) @@ -93,7 +90,7 @@ int stereo = 0; /* do stereo? */ int displist; /* our scene display list */ -int in_dev_view = 0; /* currently in dev_view() */ +int no_render = 0; /* don't rerender */ #ifdef BSD #define strchr index @@ -176,7 +173,8 @@ char *argv[]; /* all done */ quit(0); userr: - fprintf(stderr, "Usage: %s [-w][-b][-v view] rfile [VAR=value]..\n", + fprintf(stderr, + "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n", argv[0]); quit(1); } @@ -300,7 +298,7 @@ char **av; atof(sskip2(buf+4,1)), atof(sskip2(buf+4,2))); else if (backvis && !strncmp(buf, "-bv", 3) && - (!buf[3] || strchr(" 0-FfNn", buf[3]) != NULL)) + (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL)) backvis = 0; fclose(fp); unlink(optfile); /* delete options file */ @@ -374,7 +372,6 @@ char *id; GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE,15, None}; XSetWindowAttributes ourwinattr; XWMHints ourxwmhints; - XSizeHints oursizhints; /* open display server */ ourdisplay = XOpenDisplay(NULL); if (ourdisplay == NULL) @@ -421,25 +418,20 @@ char *id; ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind, glradicon_bits, glradicon_width, glradicon_height); XSetWMHints(ourdisplay, gwind, &ourxwmhints); - oursizhints.min_width = MINWIDTH; - oursizhints.min_height = stereo ? MINHEIGHT/2 : MINHEIGHT; - oursizhints.flags = PMinSize; - XSetNormalHints(ourdisplay, gwind, &oursizhints); /* set GLX context */ glXMakeCurrent(ourdisplay, gwind, gctx); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glShadeModel(GL_SMOOTH); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glEnable(GL_LIGHTING); + glFrontFace(GL_CCW); + glCullFace(GL_BACK); if (backvis) glDisable(GL_CULL_FACE); - else { - glFrontFace(GL_CCW); - glCullFace(GL_BACK); + else glEnable(GL_CULL_FACE); - } glDrawBuffer(GL_BACK); /* figure out sensible view */ pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) / @@ -452,9 +444,11 @@ char *id; } /* map the window */ XMapWindow(ourdisplay, gwind); + no_render++; do dev_input(0); /* get resize event */ while (hres == 0 & vres == 0); + no_render--; rgl_checkerr("initializing GLX"); } @@ -505,12 +499,12 @@ register VIEW *nv; } } if (newhres != hres | newvres != vres) { - in_dev_view++; + no_render++; XResizeWindow(ourdisplay, gwind, newhres, newvres); do dev_input(0); /* get resize event */ while (newhres != hres | newvres != vres); - in_dev_view--; + no_render--; } } copystruct(&thisview, nv); @@ -564,7 +558,7 @@ render() /* render our display list and swap buffers { double d; - if (!mapped) + if (!mapped | no_render) return; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glCallList(displist); @@ -815,8 +809,6 @@ int vwnum; ; else if (vwnum >= MAXVIEW || vwl[vwnum].v == NULL) vwnum = 0; - if (vwnum == currentview) - return; copylastv("standard view"); dev_view(vwl[currentview=vwnum].v); } @@ -890,7 +882,7 @@ register XConfigureEvent *ersz; glViewport(0, 0, hres=ersz->width, vres=ersz->height); if (hres > maxhres) maxhres = hres; if (vres > maxvres) maxvres = vres; - if (in_dev_view) + if (no_render) return; wa = (vres*pheight)/(hres*pwidth); va = viewaspect(&thisview);