40 |
|
#define RAYQLEN 50000 /* max. rays to queue before flush */ |
41 |
|
#endif |
42 |
|
|
43 |
+ |
/* values other than 0 or 255 do not map reliably */ |
44 |
|
#ifndef PORTALP |
45 |
< |
#define PORTRED 2 /* portal red color */ |
46 |
< |
#define PORTGRN -1 /* portal green left alone */ |
47 |
< |
#define PORTBLU 128 /* portal blue color */ |
48 |
< |
#define PORTALP -1 /* don't use alpha channel */ |
45 |
> |
#define PORTRED 0 /* -1, 0 or 255 */ |
46 |
> |
#define PORTGRN -1 /* -1, 0 or 255 */ |
47 |
> |
#define PORTBLU 255 /* -1, 0 or 255 */ |
48 |
> |
#define PORTALP -1 /* -1 or 255 */ |
49 |
|
#endif |
50 |
|
#define isportal(c) ((PORTRED<0 || (c)[0]==PORTRED) && \ |
51 |
|
(PORTGRN<0 || (c)[1]==PORTGRN) && \ |
52 |
|
(PORTBLU<0 || (c)[2]==PORTBLU) && \ |
53 |
|
(PORTALP<0 || (c)[3]==PORTALP)) |
54 |
+ |
#define doportals() if (gmPortals) \ |
55 |
+ |
gmDrawPortals(PORTRED,PORTGRN,PORTBLU,PORTALP); else |
56 |
|
|
57 |
|
#ifndef FEQ |
58 |
|
#define FEQ(a,b) ((a)-(b) <= FTINY && (a)-(b) >= -FTINY) |
156 |
|
#else |
157 |
|
static int atlBest[] = {GLX_RGBA, GLX_DOUBLEBUFFER, |
158 |
|
GLX_RED_SIZE,8, GLX_GREEN_SIZE,8, |
159 |
< |
GLX_BLUE_SIZE,8, GLX_ALPHA_SIZE,2, |
159 |
> |
GLX_BLUE_SIZE,8, GLX_ALPHA_SIZE,1, |
160 |
|
GLX_DEPTH_SIZE,15, None}; |
161 |
|
static int atlOK[] = {GLX_RGBA, GLX_DOUBLEBUFFER, |
162 |
< |
GLX_RED_SIZE,4, GLX_GREEN_SIZE,4, |
163 |
< |
GLX_BLUE_SIZE,4, GLX_ALPHA_SIZE,2, |
162 |
> |
GLX_RED_SIZE,5, GLX_GREEN_SIZE,5, |
163 |
> |
GLX_BLUE_SIZE,5, GLX_ALPHA_SIZE,1, |
164 |
|
GLX_DEPTH_SIZE,15, None}; |
165 |
|
#endif |
166 |
|
char *ev; |
462 |
|
#ifdef DOBJ |
463 |
|
ndrawn += dobj_render(); |
464 |
|
#endif |
465 |
< |
if (ndrawn && gmPortals) |
466 |
< |
gmDrawPortals(PORTRED,PORTGRN,PORTBLU,PORTALP); |
465 |
> |
if (ndrawn) |
466 |
> |
doportals(); |
467 |
|
checkglerr("rendering right eye"); |
468 |
|
popright(); /* draw left eye */ |
469 |
|
#endif |
471 |
|
#ifdef DOBJ |
472 |
|
ndrawn += dobj_render(); |
473 |
|
#endif |
474 |
< |
if (ndrawn && gmPortals) |
475 |
< |
gmDrawPortals(PORTRED,PORTGRN,PORTBLU,PORTALP); |
474 |
> |
if (ndrawn) |
475 |
> |
doportals(); |
476 |
|
glXSwapBuffers(ourdisplay, gwind); |
477 |
|
checkglerr("rendering base view"); |
478 |
|
} |
717 |
|
glPushAttrib(GL_LIGHTING_BIT|GL_ENABLE_BIT); |
718 |
|
glDisable(GL_LIGHTING); |
719 |
|
if (fore) |
720 |
< |
glColor3ub(0, 255, 255); |
720 |
> |
glColor3ub(4, 250, 250); |
721 |
|
else |
722 |
|
glColor3ub(0, 0, 0); |
723 |
|
glBegin(GL_LINES); /* draw each grid line */ |
840 |
|
#ifdef DOBJ |
841 |
|
ndrawn += dobj_render(); |
842 |
|
#endif |
843 |
< |
if (ndrawn && gmPortals) |
844 |
< |
gmDrawPortals(PORTRED,PORTGRN,PORTBLU,PORTALP); |
843 |
> |
if (ndrawn) |
844 |
> |
doportals(); |
845 |
|
popright(); |
846 |
|
#endif |
847 |
|
/* redraw octrees */ |
849 |
|
#ifdef DOBJ |
850 |
|
ndrawn += dobj_render(); /* redraw objects */ |
851 |
|
#endif |
852 |
< |
if (ndrawn && gmPortals) |
853 |
< |
gmDrawPortals(PORTRED, PORTGRN, PORTBLU, PORTALP); |
852 |
> |
if (ndrawn) |
853 |
> |
doportals(); |
854 |
|
glXSwapBuffers(ourdisplay, gwind); |
855 |
|
if (!ndrawn) |
856 |
|
sleep(1); /* for reasonable interaction */ |
949 |
|
wipeclean() /* prepare for redraw */ |
950 |
|
{ |
951 |
|
glDrawBuffer(GL_BACK); /* use double-buffer mode */ |
952 |
+ |
glReadBuffer(GL_FRONT); /* read back visible contents */ |
953 |
+ |
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
954 |
|
/* clear buffers */ |
955 |
|
#ifdef STEREO |
956 |
|
setstereobuf(STEREO_BUFFER_RIGHT); |
958 |
|
setstereobuf(STEREO_BUFFER_LEFT); |
959 |
|
#endif |
960 |
|
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); |
961 |
+ |
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); |
962 |
|
freedepth(); |
963 |
|
if ((viewflags&(VWCHANGE|VWSTEADY)) == |
964 |
|
(VWCHANGE|VWSTEADY)) { /* clear samples if new */ |