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.9 by gwlarson, Tue Dec 22 12:59:17 1998 UTC vs.
Revision 3.10 by gwlarson, Wed Dec 23 17:43:42 1998 UTC

# Line 231 | Line 231 | char  *id;
231          glDisable(GL_CULL_FACE);
232          glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
233          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
234 +        glPixelStorei(GL_PACK_ALIGNMENT, 1);
235 +        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
236                                          /* figure out sensible view */
237          pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) /
238                          DisplayWidth(ourdisplay, ourscreen);
# Line 280 | Line 282 | dev_close()                    /* close our display and free resources
282  
283   dev_clear()                     /* clear our representation */
284   {
285 <        wipeclean();
285 >        viewflags |= VWCHANGE;          /* pretend our view has changed */
286 >        wipeclean();                    /* clean off display and samples */
287          rayqleft = 0;                   /* hold off update */
288   }
289  
# Line 502 | Line 505 | xferdepth()                    /* load and clear depth buffer */
505          }
506                                  /* allocate alpha buffer for portals */
507          if (gmPortals)
508 <                pbuf = (GLubyte *)malloc(odev.hres*odev.vres *
506 <                                (4*sizeof(GLubyte)));
508 >                pbuf = (GLubyte *)malloc(odev.hres*odev.vres*sizeof(GLubyte));
509          else
510                  pbuf = NULL;
511   #ifdef STEREO
# Line 514 | Line 516 | xferdepth()                    /* load and clear depth buffer */
516                  glClear(GL_COLOR_BUFFER_BIT);
517                  gmDrawPortals(0xff, -1, -1, -1);
518                  glReadPixels(0, 0, odev.hres, odev.vres,
519 <                                GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
519 >                                GL_RED, GL_UNSIGNED_BYTE, pbuf);
520          }
521          for (dbp = depthright + odev.hres*odev.vres; dbp-- > depthright; )
522 <                if (pbuf != NULL && pbuf[4*(dbp-depthright)]&0x40)
522 >                if (pbuf != NULL && pbuf[dbp-depthright]&0x40)
523                          *dbp = FHUGE;
524                  else
525                          *dbp = mapdepth(*dbp);
# Line 532 | Line 534 | xferdepth()                    /* load and clear depth buffer */
534                  glClear(GL_COLOR_BUFFER_BIT);           /* find portals */
535                  gmDrawPortals(0xff, -1, -1, -1);
536                  glReadPixels(0, 0, odev.hres, odev.vres,
537 <                                GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
537 >                                GL_RED, GL_UNSIGNED_BYTE, pbuf);
538 > #ifdef DEBUG
539 >                glXSwapBuffers(ourdisplay, gwind);
540 > #endif
541          }
542          for (dbp = depthbuffer + odev.hres*odev.vres; dbp-- > depthbuffer; )
543 <                if (pbuf != NULL && pbuf[4*(dbp-depthbuffer)]&0x40)
543 >                if (pbuf != NULL && pbuf[dbp-depthbuffer]&0x40)
544                          *dbp = FHUGE;
545                  else
546                          *dbp = mapdepth(*dbp);
# Line 845 | Line 850 | register VIEW  *vp;
850                  dev_zmax = 100.;
851          } else {
852                  dev_zmin = 0.5*depthlim[0];
853 <                dev_zmax = 1.75*depthlim[1];
853 >                dev_zmax = 2.0*depthlim[1];
854                  if (dev_zmin > dev_zmax/5.)
855                          dev_zmin = dev_zmax/5.;
856          }
# Line 928 | Line 933 | wipeclean()                    /* prepare for redraw */
933                          (VWCHANGE|VWSTEADY)) {  /* clear samples if new */
934                  odClean();
935                  viewflags &= ~VWCHANGE;         /* change noted */
936 <        }
936 >        } else if (viewflags & VWSTEADY)
937 >                odRedrawAll();
938          setglpersp(&odev.v);            /* reset view & clipping planes */
939   }
940  
# Line 979 | Line 985 | register XKeyPressedEvent  *ekey;
985                  inpresflags |= DFL(DC_RESUME);
986                  return;
987          case CTRL('R'):                 /* redraw screen */
988 <                odRemap(0);
988 >                odRemap(0);                     /* new tone mapping */
989                  glClear(GL_DEPTH_BUFFER_BIT);
990   #ifdef STEREO
991                  setstereobuf(STEREO_BUFFER_RIGHT);
# Line 992 | Line 998 | register XKeyPressedEvent  *ekey;
998                          return;
999                  XRaiseWindow(ourdisplay, gwind);
1000                  XFlush(ourdisplay);
1001 <                sleep(1);
1002 <                wipeclean();                    /* fresh display */
997 <                odRemap(1);                     /* fresh tone mapping */
1001 >                sleep(1);                       /* wait for restacking */
1002 >                dev_clear();                    /* clear display and samples */
1003                  dev_flush();                    /* draw octrees */
1004 +                odRemap(1);                     /* start fresh histogram */
1005                  inpresflags |= DFL(DC_REDRAW);  /* resend values from server */
1000                rayqleft = 0;                   /* hold off update */
1006                  return;
1007          case 'K':                       /* kill rtrace process(es) */
1008                  inpresflags |= DFL(DC_KILL);
# Line 1030 | Line 1035 | register XExposeEvent  *eexp;
1035          }
1036          xmin = eexp->x; xmax = eexp->x + eexp->width;
1037          ymin = odev.vres - eexp->y - eexp->height; ymax = odev.vres - eexp->y;
1038 +
1039 +        if (xmin <= 0 && xmax >= odev.hres-1 &&
1040 +                        ymin <= 0 && ymax >= odev.vres) {
1041 +                DCHECK(eexp->count, WARNING, "multiple clear in fixwindow");
1042 +                if (viewflags & VWORTHO)        /* workaround for... */
1043 +                        glDrawBuffer(GL_FRONT); /* ...GLX window mapping bug */
1044 +                glClear(GL_DEPTH_BUFFER_BIT);   /* clear the entire buffer */
1045 + #ifdef STEREO
1046 +                setstereobuf(STEREO_BUFFER_RIGHT);
1047 +                glClear(GL_DEPTH_BUFFER_BIT);
1048 +                setstereobuf(STEREO_BUFFER_LEFT);
1049 + #endif
1050 +                odRedrawAll();
1051 +                return;
1052 +        }
1053                                                  /* clear portion of depth */
1054          glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
1055          glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines