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

Comparing ray/src/common/rglfile.c (file contents):
Revision 3.2 by gwlarson, Mon Aug 17 17:57:59 1998 UTC vs.
Revision 3.3 by gwlarson, Fri Jan 29 15:27:22 1999 UTC

# Line 22 | Line 22 | extern int     m_normal(), m_glass(), m_aniso(), m_brdf(),
22  
23   FUN  ofun[NUMOTYPE] = INIT_OTYPE;
24  
25 + static int      nextlist, nlistleft = 0;
26  
27 +
28   static
29   initotypes()                    /* initialize ofun array */
30   {
# Line 69 | Line 71 | initotypes()                   /* initialize ofun array */
71   int
72   newglist()                      /* allocate an OGL list id */
73   {
74 <        static int      nextlist, nleft = 0;
73 <
74 <        if (!nleft--) {
74 >        if (!nlistleft--) {
75                  nextlist = glGenLists(NLIST2ALLOC);
76 <                nleft = NLIST2ALLOC-1;
76 >                if (!nextlist)
77 >                        error(SYSTEM, "no list space left in newglist");
78 >                nlistleft = NLIST2ALLOC-1;
79          }
80          return(nextlist++);
81   }
# Line 93 | Line 95 | char   *where;
95  
96  
97   int
98 < rgl_filelist(ic, inp)           /* load scene files into display list */
98 > rgl_filelist(ic, inp, nl)       /* load scene files into display list */
99   int     ic;
100   char    **inp;
101 + int     *nl;                    /* returned number of lists (optional) */
102   {
103          int     listid;
104  
# Line 110 | Line 113 | char   **inp;
113          glEndList();            /* end of top display list */
114          lightdefs();            /* define light sources */
115          loadoctrees();          /* load octrees (sublists) for instances */
116 +        if (nl != NULL)         /* return total number of lists allocated */
117 +                *nl = nextlist - listid;
118          return(listid);         /* all done -- return list id */
119   }
120  
121  
122   int
123 < rgl_octlist(fname, cent, radp)  /* load octree objects into display list */
123 > rgl_octlist(fname, cent, radp, nl)      /* load scen into display list */
124   char    *fname;
125   FVECT   cent;                   /* returned octree center (optional) */
126   FLOAT   *radp;                  /* returned octree size (optional) */
127 + int     *nl;                    /* returned number of lists (optional) */
128   {
129          double  r;
130          int     listid;
# Line 137 | Line 143 | FLOAT  *radp;                  /* returned octree size (optional) */
143          glEndList();            /* close top list */
144          lightdefs();            /* define light sources */
145          loadoctrees();          /* load referenced octrees into sublists */
146 +        if (nl != NULL)         /* return total number of lists allocated */
147 +                *nl = nextlist - listid;
148          return(listid);
149   }
150  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines