162 |
|
#endif |
163 |
|
/* open display server */ |
164 |
|
ourdisplay = XOpenDisplay(NULL); |
165 |
< |
if (ourdisplay == NULL) |
166 |
< |
error(USER, "cannot open X-windows; DISPLAY variable set?\n"); |
165 |
> |
CHECK(ourdisplay==NULL, USER, |
166 |
> |
"cannot open X-windows; DISPLAY variable set?"); |
167 |
|
#ifdef STEREO |
168 |
|
switch (XSGIQueryStereoMode(ourdisplay, ourroot)) { |
169 |
|
case STEREO_TOP: |
171 |
|
break; |
172 |
|
case STEREO_OFF: |
173 |
|
error(USER, |
174 |
< |
"wrong video mode: run \"/usr/gfx/setmon -n STR_TOP\" first"); |
174 |
> |
"wrong video mode: run \"/usr/gfx/setmon -n STR_TOP\" first"); |
175 |
|
case X_STEREO_UNSUPPORTED: |
176 |
|
error(USER, "stereo mode not supported on this screen"); |
177 |
|
default: |
180 |
|
#endif |
181 |
|
/* find a usable visual */ |
182 |
|
ourvinf = glXChooseVisual(ourdisplay, ourscreen, atlBest); |
183 |
< |
if (ourvinf == NULL) |
184 |
< |
error(USER, "no suitable visuals available"); |
183 |
> |
CHECK(ourvinf==NULL, USER, "no suitable visuals available"); |
184 |
|
/* get a context */ |
185 |
|
gctx = glXCreateContext(ourdisplay, ourvinf, NULL, GL_TRUE); |
186 |
|
/* set gamma and tone mapping */ |
212 |
|
#endif |
213 |
|
BORWIDTH, ourvinf->depth, InputOutput, ourvinf->visual, |
214 |
|
CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &ourwinattr); |
215 |
< |
if (gwind == 0) |
217 |
< |
error(SYSTEM, "cannot create window\n"); |
215 |
> |
CHECK(gwind==0, SYSTEM, "cannot create window"); |
216 |
|
XStoreName(ourdisplay, gwind, id); |
217 |
|
/* set window manager hints */ |
218 |
|
ourxwmhints.flags = InputHint|IconPixmapHint; |
260 |
|
XMapWindow(ourdisplay, gwind); |
261 |
|
dev_input(); /* sets size and view angles */ |
262 |
|
if (!odInit(DisplayWidth(ourdisplay,ourscreen) * |
263 |
< |
DisplayHeight(ourdisplay,ourscreen) / 10)) |
263 |
> |
DisplayHeight(ourdisplay,ourscreen) / 4)) |
264 |
|
error(SYSTEM, "insufficient memory for value storage"); |
265 |
|
odev.name = id; |
266 |
|
odev.firstuse = 1; /* can't recycle samples */ |
361 |
|
if (gfn == NULL) { |
362 |
|
gmEndGeom(); |
363 |
|
gmEndPortal(); |
364 |
+ |
wipeclean(); /* new geometry, so redraw it */ |
365 |
|
return; |
366 |
|
} |
367 |
|
if (access(gfn, R_OK) == 0) |
462 |
|
gmDrawPortals(PORTRED, PORTGRN, PORTBLU, PORTALP); |
463 |
|
checkglerr("rendering base view"); |
464 |
|
} |
465 |
< |
if (mapped && viewsteady) { |
466 |
< |
if (isperspective) { /* first time after steady */ |
468 |
< |
#ifdef STEREO |
469 |
< |
pushright(); |
470 |
< |
popright(); |
471 |
< |
#endif |
465 |
> |
if (mapped && viewsteady) |
466 |
> |
if (isperspective > 0) { /* first time after steady */ |
467 |
|
if (ndrawn) |
468 |
|
xferdepth(); /* transfer and clear depth */ |
469 |
|
setglortho(); /* set orthographic view */ |
470 |
< |
} else { |
470 |
> |
} else if (!isperspective) { |
471 |
|
#ifdef STEREO |
472 |
|
pushright(); |
473 |
|
odUpdate(1); /* draw right eye */ |
475 |
|
#endif |
476 |
|
odUpdate(0); /* draw left eye */ |
477 |
|
} |
483 |
– |
} |
478 |
|
glFlush(); /* flush OpenGL */ |
479 |
|
rayqleft = RAYQLEN; |
480 |
|
/* flush X11 and return # pending */ |
508 |
|
#endif |
509 |
|
depthbuffer = (GLfloat *)malloc( |
510 |
|
odev.hres*odev.vres*sizeof(GLfloat)); |
511 |
< |
if (depthbuffer == NULL) |
518 |
< |
error(SYSTEM, "out of memory in xferdepth"); |
511 |
> |
CHECK(depthbuffer==NULL, SYSTEM, "out of memory in xferdepth"); |
512 |
|
} |
513 |
|
/* allocate alpha buffer for portals */ |
514 |
|
if (gmPortals) |