ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/glrad.c
(Generate patch)

Comparing ray/src/util/glrad.c (file contents):
Revision 3.4 by gwlarson, Wed Jun 10 17:52:18 1998 UTC vs.
Revision 3.10 by gwlarson, Thu Oct 15 08:30:48 1998 UTC

# Line 33 | Line 33 | static char SCCSid[] = "$SunId$ SGI";
33   #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
34   #define MOVORB(s)       ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)
35  
36 #define MINWIDTH        480             /* minimum graphics window width */
37 #define MINHEIGHT       400             /* minimum graphics window height */
38
36   #define BORWIDTH        5               /* border width */
37  
38   #define  ourscreen      DefaultScreen(ourdisplay)
# Line 93 | Line 90 | int    stereo = 0;                     /* do stereo? */
90  
91   int     displist;                       /* our scene display list */
92  
93 < int     in_dev_view = 0;                /* currently in dev_view() */
93 > int     no_render = 0;                  /* don't rerender */
94  
95   #ifdef BSD
96   #define strchr          index
# Line 176 | Line 173 | char   *argv[];
173                                          /* all done */
174          quit(0);
175   userr:
176 <        fprintf(stderr, "Usage: %s [-w][-b][-v view] rfile [VAR=value]..\n",
176 >        fprintf(stderr,
177 >                "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n",
178                          argv[0]);
179          quit(1);
180   }
# Line 300 | Line 298 | char   **av;
298                                          atof(sskip2(buf+4,1)),
299                                          atof(sskip2(buf+4,2)));
300                  else if (backvis && !strncmp(buf, "-bv", 3) &&
301 <                                (!buf[3] || strchr(" 0-FfNn", buf[3]) != NULL))
301 >                                (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL))
302                          backvis = 0;
303          fclose(fp);
304          unlink(optfile);                        /* delete options file */
# Line 374 | Line 372 | char  *id;
372                                  GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE,15, None};
373          XSetWindowAttributes    ourwinattr;
374          XWMHints        ourxwmhints;
377        XSizeHints      oursizhints;
375                                          /* open display server */
376          ourdisplay = XOpenDisplay(NULL);
377          if (ourdisplay == NULL)
# Line 421 | Line 418 | char  *id;
418          ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
419                  gwind, glradicon_bits, glradicon_width, glradicon_height);
420          XSetWMHints(ourdisplay, gwind, &ourxwmhints);
424        oursizhints.min_width = MINWIDTH;
425        oursizhints.min_height = stereo ? MINHEIGHT/2 : MINHEIGHT;
426        oursizhints.flags = PMinSize;
427        XSetNormalHints(ourdisplay, gwind, &oursizhints);
421                                          /* set GLX context */
422          glXMakeCurrent(ourdisplay, gwind, gctx);
423          glEnable(GL_DEPTH_TEST);
424          glDepthFunc(GL_LESS);
425          glShadeModel(GL_SMOOTH);
426          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
427 <        glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
427 >        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
428          glEnable(GL_LIGHTING);
429 +        glFrontFace(GL_CCW);
430 +        glCullFace(GL_BACK);
431          if (backvis)
432                  glDisable(GL_CULL_FACE);
433 <        else {
439 <                glFrontFace(GL_CCW);
440 <                glCullFace(GL_BACK);
433 >        else
434                  glEnable(GL_CULL_FACE);
442        }
435          glDrawBuffer(GL_BACK);
436                                          /* figure out sensible view */
437          pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) /
# Line 452 | Line 444 | char  *id;
444          }
445                                          /* map the window */
446          XMapWindow(ourdisplay, gwind);
447 +        no_render++;
448          do
449                  dev_input(0);           /* get resize event */
450          while (hres == 0 & vres == 0);
451 +        no_render--;
452          rgl_checkerr("initializing GLX");
453   }
454  
# Line 505 | Line 499 | register VIEW  *nv;
499                          }
500                  }
501                  if (newhres != hres | newvres != vres) {
502 <                        in_dev_view++;
502 >                        no_render++;
503                          XResizeWindow(ourdisplay, gwind, newhres, newvres);
504                          do
505                                  dev_input(0);           /* get resize event */
506                          while (newhres != hres | newvres != vres);
507 <                        in_dev_view--;
507 >                        no_render--;
508                  }
509          }
510          copystruct(&thisview, nv);
# Line 564 | Line 558 | render()                       /* render our display list and swap buffers
558   {
559          double  d;
560  
561 <        if (!mapped)
561 >        if (!mapped | no_render)
562                  return;
563          glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
564          glCallList(displist);
# Line 815 | Line 809 | int    vwnum;
809                          ;
810          else if (vwnum >= MAXVIEW || vwl[vwnum].v == NULL)
811                  vwnum = 0;
818        if (vwnum == currentview)
819                return;
812          copylastv("standard view");
813          dev_view(vwl[currentview=vwnum].v);
814   }
# Line 890 | Line 882 | register XConfigureEvent  *ersz;
882          glViewport(0, 0, hres=ersz->width, vres=ersz->height);
883          if (hres > maxhres) maxhres = hres;
884          if (vres > maxvres) maxvres = vres;
885 <        if (in_dev_view)
885 >        if (no_render)
886                  return;
887          wa = (vres*pheight)/(hres*pwidth);
888          va = viewaspect(&thisview);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines