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);
34 gcvalues.plane_mask= planemasks[i];
36 gcvalues.function= GXclear;
37 fabric[i]= XCreateGC(display,window,
38 GCFunction|GCPlaneMask,
41 gcvalues.function= GXset;
42 mesh[i]= XCreateGC(display,window,
43 GCFunction|GCPlaneMask,
46 XSelectInput(display,window,0);
47 XMapWindow(display,window);
51 void DualX11Output::startimage() {
52 XClearWindow(display,window);
55 void DualX11Output::endimage() {
59 DualX11Output::~DualX11Output() {
60 XCloseDisplay(display);
63 void DualX11Output::drawcell(const Point* list, int n) {
64 static Parameter<double> eyeseparation("eyesep",
65 "Distance from projection eye to origin",
67 for (int i=0; i<2; i++) {
68 Point::seteyex(eyeseparation*(i-0.5));
70 for (int j=0; j<n; j++) {
71 Onscreen here= Onscreen(list[j]);
72 xp[j].x= (int)((here.x+1.0)*250.0);
73 xp[j].y= (int)((-here.y+1.0)*250.0);
75 XFillPolygon(display,window,fabric[i],xp,n,Nonconvex,CoordModeOrigin);
77 XDrawLines(display,window,mesh[i],xp,n+1,CoordModeOrigin);