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

Comparing ray/src/hd/rhd_glx1.c (file contents):
Revision 3.2 by schorsch, Mon Jul 21 22:30:18 2003 UTC vs.
Revision 3.5 by greg, Fri Jan 7 20:33:02 2005 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   #include "standard.h"
10  
11   #include  <GL/glx.h>
12 + #include  <GL/glu.h>
13  
14 + #include "platform.h"
15   #include "rhd_qtree.h"
16 <
16 > #include "rhdriver.h"
17 > #include "rhdisp.h"
18   #include  "x11icon.h"
19  
20   #ifndef RAYQLEN
# Line 58 | Line 61 | static const char      RCSid[] = "$Id$";
61  
62   struct driver   odev;                   /* global device driver structure */
63  
64 + TMstruct        *tmGlobal;              /* global tone-mapping structure */
65 +
66   char odev_args[64];                     /* command arguments */
67  
68   static XEvent  currentevent;            /* current event */
# Line 85 | Line 90 | static int     inpresflags;            /* input result flags */
90  
91   static int      headlocked = 0;         /* lock vertical motion */
92  
88 static int  resizewindow(), getevent(), getkey(), moveview(),
89                initcones(), freecones(),
90                getmove(), fixwindow(), mytmflags();
93  
94 + static int mytmflags(void);
95 + static void initcones(void);
96 + static void freecones(void);
97 + static void getevent(void);
98 + static void draw3dline(FVECT    wp[2]);
99 + static void draw_grids(void);
100 + static int moveview(int dx, int dy, int mov, int        orb);
101 + static void getmove(XButtonPressedEvent *ebut);
102 + static void getkey(XKeyPressedEvent  *ekey);
103 + static void fixwindow(XExposeEvent  *eexp);
104 + static void resizewindow(XConfigureEvent  *ersz);
105  
106 < dev_open(id)                    /* initialize X11 driver */
107 < char  *id;
106 >
107 > extern void
108 > dev_open(
109 >        char  *id
110 > )
111   {
112          extern char     *getenv();
113          static RGBPRIMS myprims = STDPRIMS;
# Line 128 | Line 144 | char  *id;
144                                  &myprims[BLU][CIEX],&myprims[BLU][CIEY],
145                                  &myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6)
146                  dpri = myprims;
147 <        if (tmInit(mytmflags(), dpri, gamval) == NULL)
147 >        tmGlobal = tmInit(mytmflags(), dpri, gamval);
148 >        if (tmGlobal == NULL)
149                  error(SYSTEM, "not enough memory in dev_open");
150                                          /* open window */
151          ourwinattr.background_pixel = ourblack;
# Line 187 | Line 204 | char  *id;
204   }
205  
206  
207 < dev_close()                     /* close our display and free resources */
207 > extern void
208 > dev_close(void)                 /* close our display and free resources */
209   {
210          glXMakeCurrent(ourdisplay, None, NULL);
211          glXDestroyContext(ourdisplay, gctx);
# Line 196 | Line 214 | dev_close()                    /* close our display and free resources
214          XCloseDisplay(ourdisplay);
215          ourdisplay = NULL;
216          qtFreeLeaves();
217 <        tmDone(NULL);
217 >        tmDone(tmGlobal);
218          freecones();
219          odev.v.type = 0;
220          odev.hres = odev.vres = 0;
# Line 204 | Line 222 | dev_close()                    /* close our display and free resources
222   }
223  
224  
225 < dev_clear()                     /* clear our quadtree */
225 > extern void
226 > dev_clear(void)                 /* clear our quadtree */
227   {
228          qtCompost(100);
229          glClear(GL_DEPTH_BUFFER_BIT);
# Line 212 | Line 231 | dev_clear()                    /* clear our quadtree */
231   }
232  
233  
234 < int
235 < dev_view(nv)                    /* assign new driver view */
236 < register VIEW   *nv;
234 > extern int
235 > dev_view(                       /* assign new driver view */
236 >        register VIEW   *nv
237 > )
238   {
239          if (nv->type == VT_PAR ||               /* check view legality */
240                          nv->horiz > 160. || nv->vert > 160.) {
# Line 264 | Line 284 | register VIEW  *nv;
284   }
285  
286  
287 < dev_section(ofn)                /* add octree for geometry rendering */
288 < char    *ofn;
287 > extern void
288 > dev_section(            /* add octree for geometry rendering */
289 >        char    *ofn
290 > )
291   {
292          /* unimplemented */
293   }
294  
295  
296 < dev_auxcom(cmd, args)           /* process an auxiliary command */
297 < char    *cmd, *args;
296 > extern void
297 > dev_auxcom(             /* process an auxiliary command */
298 >        char    *cmd,
299 >        char    *args
300 > )
301   {
302          sprintf(errmsg, "%s: unknown command", cmd);
303          error(COMMAND, errmsg);
304   }
305  
306  
307 < VIEW *
308 < dev_auxview(n, hvres)           /* return nth auxiliary view */
309 < int     n;
310 < int     hvres[2];
307 > extern VIEW *
308 > dev_auxview(            /* return nth auxiliary view */
309 >        int     n,
310 >        int     hvres[2]
311 > )
312   {
313          if (n)
314                  return(NULL);
# Line 291 | Line 317 | int    hvres[2];
317   }
318  
319  
320 < int
321 < dev_input()                     /* get X11 input */
320 > extern int
321 > dev_input(void)                 /* get X11 input */
322   {
323          inpresflags = 0;
324  
# Line 305 | Line 331 | dev_input()                    /* get X11 input */
331   }
332  
333  
334 < int
335 < dev_flush()                     /* flush output */
334 > extern int
335 > dev_flush(void)                 /* flush output */
336   {
337          qtUpdate();
338          glFlush();
# Line 315 | Line 341 | dev_flush()                    /* flush output */
341   }
342  
343  
344 < dev_cone(rgb, ip, rad)          /* render a cone in view coordinates */
345 < BYTE    rgb[3];
346 < FVECT   ip;
347 < double  rad;
344 > extern void
345 > dev_cone(               /* render a cone in view coordinates */
346 >        BYTE    rgb[3],
347 >        FVECT   ip,
348 >        double  rad
349 > )
350   {
351          register int    ci, j;
352          double  apexh, basez;
# Line 355 | Line 383 | double rad;
383  
384  
385   static int
386 < mytmflags()                     /* figure out tone mapping flags */
386 > mytmflags(void)                 /* figure out tone mapping flags */
387   {
388          extern char     *progname;
389          register char   *cp, *tail;
# Line 370 | Line 398 | mytmflags()                    /* figure out tone mapping flags */
398          if (cp-tail == 5 && !strncmp(tail, "glx1h", 5))
399                  return(TM_F_HUMAN|TM_F_NOSTDERR);
400          error(USER, "illegal driver name");
401 +        return -1; /* pro forma return */
402   }
403  
404  
405 < static
406 < initcones()                     /* initialize cone vertices */
405 > static void
406 > initcones(void)                 /* initialize cone vertices */
407   {
408          register int    i, j;
409          double  minrad, d;
# Line 400 | Line 429 | initcones()                    /* initialize cone vertices */
429   }
430  
431  
432 < static
433 < freecones()                     /* free cone vertices */
432 > static void
433 > freecones(void)                 /* free cone vertices */
434   {
435          register int    i;
436  
# Line 414 | Line 443 | freecones()                    /* free cone vertices */
443   }
444  
445  
446 < static
447 < getevent()                      /* get next event */
446 > static void
447 > getevent(void)                  /* get next event */
448   {
449          XNextEvent(ourdisplay, levptr(XEvent));
450          switch (levptr(XEvent)->type) {
# Line 441 | Line 470 | getevent()                     /* get next event */
470   }
471  
472  
473 < static
474 < draw3dline(wp)                  /* draw 3d line in world coordinates */
475 < register FVECT  wp[2];
473 > static void
474 > draw3dline(                     /* draw 3d line in world coordinates */
475 >        register FVECT  wp[2]
476 > )
477   {
478          glVertex3d(wp[0][0], wp[0][1], wp[0][2]);
479          glVertex3d(wp[1][0], wp[1][1], wp[1][2]);
480   }
481  
482  
483 < static
484 < draw_grids()                    /* draw holodeck section grids */
483 > static void
484 > draw_grids(void)                        /* draw holodeck section grids */
485   {
486          static BYTE     gridrgba[4] = {0x0, 0xff, 0xff, 0x00};
487          double  xmin, xmax, ymin, ymax, zmin, zmax;
488 <        double  d, cx, sx, crad;
459 <        FVECT   vx, vy;
460 <        register int    i, j;
488 >        double  d;
489                                          /* can we even do it? */
490          if (!mapped || odev.v.type != VT_PER)
491                  return;
# Line 498 | Line 526 | draw_grids()                   /* draw holodeck section grids */
526   }
527  
528  
529 < static
530 < moveview(dx, dy, mov, orb)      /* move our view */
531 < int     dx, dy, mov, orb;
529 > static int
530 > moveview(       /* move our view */
531 >        int     dx,
532 >        int     dy,
533 >        int     mov,
534 >        int     orb
535 > )
536   {
537          VIEW    nv;
538          FVECT   odir, v1;
# Line 546 | Line 578 | int    dx, dy, mov, orb;
578   }
579  
580  
581 < static
582 < getmove(ebut)                           /* get view change */
583 < XButtonPressedEvent     *ebut;
581 > static void
582 > getmove(                                /* get view change */
583 >        XButtonPressedEvent     *ebut
584 > )
585   {
586          int     movdir = MOVDIR(ebut->button);
587          int     movorb = MOVORB(ebut->state);
# Line 588 | Line 621 | XButtonPressedEvent    *ebut;
621   }
622  
623  
624 < static
625 < getkey(ekey)                            /* get input key */
626 < register XKeyPressedEvent  *ekey;
624 > static void
625 > getkey(                         /* get input key */
626 >        register XKeyPressedEvent  *ekey
627 > )
628   {
629          int  n;
630          char    buf[8];
# Line 659 | Line 693 | register XKeyPressedEvent  *ekey;
693   }
694  
695  
696 < static
697 < fixwindow(eexp)                         /* repair damage to window */
698 < register XExposeEvent  *eexp;
696 > static void
697 > fixwindow(                              /* repair damage to window */
698 >        register XExposeEvent  *eexp
699 > )
700   {
701          int     xmin, xmax, ymin, ymax;
702  
# Line 684 | Line 719 | register XExposeEvent  *eexp;
719   }
720  
721  
722 < static
723 < resizewindow(ersz)                      /* resize window */
724 < register XConfigureEvent  *ersz;
722 > static void
723 > resizewindow(                   /* resize window */
724 >        register XConfigureEvent  *ersz
725 > )
726   {
727          glViewport(0, 0, ersz->width, ersz->height);
728  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines