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

Comparing ray/src/hd/rhd_ogl.c (file contents):
Revision 3.13 by gwlarson, Fri Jan 1 10:41:28 1999 UTC vs.
Revision 3.19 by greg, Sat Feb 22 02:07:24 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * OpenGL driver for holodeck display.
6   * Based on GLX driver using T-mesh.
# Line 22 | Line 19 | static char SCCSid[] = "$SunId$ SGI";
19  
20   #include "standard.h"
21  
25 #include <sys/types.h>
22   #include <GL/glx.h>
23   #include <GL/glu.h>
24   #ifdef STEREO
25   #include <X11/extensions/SGIStereo.h>
26   #endif
27 + #include <time.h>
28  
29   #include "rhd_odraw.h"
30   #ifdef DOBJ
# Line 39 | Line 36 | static char SCCSid[] = "$SunId$ SGI";
36   #ifndef RAYQLEN
37   #define RAYQLEN         0               /* max. rays to queue before flush */
38   #endif
39 + #ifndef MINWIDTH
40 + #define MINWIDTH        480             /* minimum graphics window width */
41 + #define MINHEIGHT       400             /* minimum graphics window height */
42 + #endif
43 + #ifndef VIEWDIST
44 + #define VIEWDIST        356             /* assumed viewing distance (mm) */
45 + #endif
46 + #ifndef BORWIDTH
47 + #define BORWIDTH        5               /* border width */
48 + #endif
49  
50   #ifndef FEQ
51   #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
# Line 60 | Line 67 | static char SCCSid[] = "$SunId$ SGI";
67   #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
68   #define MOVORB(s)       ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)
69  
63 #define MINWIDTH        480             /* minimum graphics window width */
64 #define MINHEIGHT       400             /* minimum graphics window height */
65
66 #define VIEWDIST        356             /* assumed viewing distance (mm) */
67
68 #define BORWIDTH        5               /* border width */
69
70   #define setstereobuf(bid)       (glXWaitGL(), \
71                                  XSGISetStereoBuffer(ourdisplay, gwind, bid), \
72                                  glXWaitX())
# Line 331 | Line 331 | register VIEW  *nv;
331                          dev_input();    /* get resize event */
332                  }
333                  copystruct(&odev.v, nv);        /* setview() already called */
334 #ifdef STEREO
335                copystruct(&vwright, nv);
336                d = eyesepdist / sqrt(nv->hn2);
337                VSUM(vwright.vp, nv->vp, nv->hvec, d);
338                /* setview(&vwright);   -- Unnecessary */
339 #endif
334                  viewflags |= VWCHANGE;
335          }
336 + #ifdef STEREO
337 +        copystruct(&vwright, nv);
338 +        d = eyesepdist / sqrt(nv->hn2);
339 +        VSUM(vwright.vp, nv->vp, nv->hvec, d);
340 +        /* setview(&vwright);   -- Unnecessary */
341 + #endif
342          wipeclean();
343          return(1);
344   }
# Line 555 | Line 555 | xferdepth()                    /* load and clear depth buffer */
555          glClear(GL_DEPTH_BUFFER_BIT);           /* clear system depth buffer */
556          odDepthMap(0, depthbuffer);             /* transfer depth data */
557          if (pbuf != NULL)
558 <                free((char *)pbuf);             /* free our portal buffer */
558 >                free((void *)pbuf);             /* free our portal buffer */
559   }
560  
561  
# Line 566 | Line 566 | freedepth()                            /* free recorded depth buffer */
566                  return;
567   #ifdef STEREO
568          odDepthMap(1, NULL);
569 <        free((char *)depthright);
569 >        free((void *)depthright);
570          depthright = NULL;
571   #endif
572          odDepthMap(0, NULL);
573 <        free((char *)depthbuffer);
573 >        free((void *)depthbuffer);
574          depthbuffer = NULL;
575   }
576  
# Line 790 | Line 790 | XButtonPressedEvent    *ebut;
790  
791  
792   static
793 + waitabit()                              /* pause a moment */
794 + {
795 +        struct timespec ts;
796 +        ts.tv_sec = 0;
797 +        ts.tv_nsec = 5000000;
798 +        nanosleep(&ts, NULL);
799 + }
800 +
801 +
802 + static
803   getmove(ebut)                           /* get view change */
804   XButtonPressedEvent     *ebut;
805   {
# Line 806 | Line 816 | XButtonPressedEvent    *ebut;
816          setglpersp();                   /* start us off in perspective */
817          while (!XCheckMaskEvent(ourdisplay,
818                          ButtonReleaseMask, levptr(XEvent))) {
819 +                                        /* pause so as not to move too fast */
820 +                waitabit();
821                                          /* get cursor position */
822                  if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
823                                  &rootx, &rooty, &wx, &wy, &statemask))
# Line 865 | Line 877 | setglpersp()                   /* set perspective view in GL */
877                  dev_zmin = odev.v.vfore;
878          if (odev.v.vaft > FTINY)
879                  dev_zmax = odev.v.vaft;
880 <        if (dev_zmin < dev_zmax/100.)
881 <                dev_zmin = dev_zmax/100.;
880 >        if (dev_zmin*500. < dev_zmax)
881 >                dev_zmin = dev_zmax/500.;
882          setzrat();
883          xmax = dev_zmin * tan(PI/180./2. * odev.v.horiz);
884          xmin = -xmax;
# Line 942 | Line 954 | wipeclean()                    /* prepare for redraw */
954                  viewflags &= ~VWCHANGE;         /* change noted */
955          } else if (viewflags & VWSTEADY)
956                  odRedrawAll();
957 <        setglpersp(&odev.v);            /* reset view & clipping planes */
957 >        setglpersp();                   /* reset view & clipping planes */
958   }
959  
960  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines