6 #include "parameter.hh"
8 DualX11Output::DualX11Output() {
9 display= XOpenDisplay(0);
10 Colormap cmap= DefaultColormap(display,DefaultScreen(display));
12 XAllocColorCells(display,cmap,
18 XColor colours[4], *cp= colours;
19 for (int i=0; i<2; i++)
20 for (int j=0; j<2; j++, cp++) {
21 cp->pixel= pixelbase + (i? planemasks[0] :0) + (j? planemasks[1] :0);
22 cp->red= i?65535:0; cp->green= j?/*65535*/32000:0; cp->blue= 0;
23 cp->flags= DoRed|DoGreen|DoBlue;
25 XStoreColors(display,cmap,colours,4);
27 window= XCreateSimpleWindow(display,
28 DefaultRootWindow(display),
29 0,0, 500,500, 0,0, pixelbase);
33 gcvalues.plane_mask= planemasks[i];
35 gcvalues.function= GXclear;
36 fabric[i]= XCreateGC(display,window,
37 GCFunction|GCPlaneMask,
40 gcvalues.function= GXset;
41 mesh[i]= XCreateGC(display,window,
42 GCFunction|GCPlaneMask,
45 XSelectInput(display,window,0);
46 XMapWindow(display,window);
50 void DualX11Output::startimage() {
51 XClearWindow(display,window);
54 void DualX11Output::endimage() {
58 DualX11Output::~DualX11Output() {
59 XCloseDisplay(display);
62 void DualX11Output::drawcell(const Point* list, int n) {
63 static Parameter<double> eyeseparation("eyesep",
64 "Distance from projection eye to origin",
66 for (int i=0; i<2; i++) {
67 Point::seteyex(eyeseparation*(i-0.5));
69 for (int j=0; j<n; j++) {
70 Onscreen here= Onscreen(list[j]);
71 xp[j].x= (int)((here.x+1.0)*250.0);
72 xp[j].y= (int)((-here.y+1.0)*250.0);
74 XFillPolygon(display,window,fabric[i],xp,n,Nonconvex,CoordModeOrigin);
76 XDrawLines(display,window,mesh[i],xp,n+1,CoordModeOrigin);