144 |
int swaMask; |
int swaMask; |
145 |
int numReturned; |
int numReturned; |
146 |
|
|
147 |
GLXFBConfig *vinfo; |
GLXFBConfig *dbFbConfig; |
148 |
XVisualInfo *dbVinfo; |
XVisualInfo *dbVinfo; |
149 |
|
GLXContext dbContext; |
150 |
|
|
151 |
|
GLXFBConfig *pbFbConfig; |
152 |
|
GLXContext pbContext; |
153 |
|
|
154 |
vector<Timeout> timeouts; |
vector<Timeout> timeouts; |
155 |
|
|
156 |
vector<LXWindow *> windows; |
vector<LXWindow *> windows; |
157 |
// vector<IdleTasks *> idletasks; |
// vector<IdleTasks *> idletasks; |
158 |
|
|
|
GLXContext context; |
|
159 |
std::map<Win, LXWindow *> windowsByX; |
std::map<Win, LXWindow *> windowsByX; |
160 |
|
|
161 |
LXWindowSystem() { |
LXWindowSystem() { |
163 |
|
|
164 |
|
|
165 |
int nel; |
int nel; |
166 |
vinfo = glXChooseFBConfig(dpy, DefaultScreen(dpy), |
dbFbConfig = glXChooseFBConfig(dpy, DefaultScreen(dpy), |
167 |
doubleBufferAttributes, &nel); |
doubleBufferAttributes, &nel); |
168 |
|
|
169 |
if(!vinfo) BARF("Can't get dblbuf visual"); |
if(!dbFbConfig) BARF("Can't get dblbuf visual"); |
170 |
|
|
171 |
context = glXCreateNewContext(dpy, vinfo[0], GLX_RGBA_TYPE, |
dbContext = glXCreateNewContext(dpy, dbFbConfig[0], GLX_RGBA_TYPE, |
172 |
0, GL_TRUE); |
0, GL_TRUE); |
173 |
|
|
174 |
|
|
175 |
dbVinfo = glXGetVisualFromFBConfig(dpy, vinfo[0]); |
dbVinfo = glXGetVisualFromFBConfig(dpy, dbFbConfig[0]); |
176 |
swa.border_pixel = 0; |
swa.border_pixel = 0; |
177 |
|
|
178 |
swa.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), |
swa.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), |
199 |
CWBackPixmap |
CWBackPixmap |
200 |
); |
); |
201 |
|
|
202 |
|
|
203 |
|
pbFbConfig = glXChooseFBConfig(dpy, DefaultScreen(dpy), |
204 |
|
pbufferAttributes, &nel); |
205 |
|
if(!pbFbConfig) BARF("Can't get dblbuf visual"); |
206 |
|
|
207 |
|
pbContext = glXCreateNewContext(dpy, pbFbConfig[0], GLX_RGBA_TYPE, |
208 |
|
0, GL_TRUE); |
209 |
|
|
210 |
} |
} |
211 |
|
|
212 |
|
|
244 |
// |
// |
245 |
struct LXPBuffer : public Os::RenderingSurface { |
struct LXPBuffer : public Os::RenderingSurface { |
246 |
LXWindowSystem *ws; |
LXWindowSystem *ws; |
247 |
|
|
248 |
GLXPbuffer pbuf; |
GLXPbuffer pbuf; |
249 |
|
|
250 |
|
LXPBuffer(LXWindowSystem *ws, int w, int h) : ws(ws) { |
251 |
|
int attrs[] = { |
252 |
|
GLX_PBUFFER_WIDTH, w, |
253 |
|
GLX_PBUFFER_HEIGHT, h, |
254 |
|
GLX_PRESERVED_CONTENTS, 1, |
255 |
|
GLX_LARGEST_PBUFFER, 1, |
256 |
|
0 |
257 |
|
}; |
258 |
|
pbuf = glXCreatePbuffer(ws->dpy, ws->pbFbConfig[0], attrs); |
259 |
|
} |
260 |
}; |
}; |
261 |
|
|
262 |
struct LXWindow : public Os::Window { |
struct LXWindow : public Os::Window { |
314 |
DBG(dbg) << "setcurrent "<<xw<<"\n"; |
DBG(dbg) << "setcurrent "<<xw<<"\n"; |
315 |
// Can't check for GL errors; we might not have a current context! |
// Can't check for GL errors; we might not have a current context! |
316 |
// GLERR |
// GLERR |
317 |
bool ret = glXMakeCurrent(ws->dpy, xw, ws->context); |
bool ret = glXMakeCurrent(ws->dpy, xw, ws->dbContext); |
318 |
// GLERR |
// GLERR |
319 |
DBG(dbg) << "setcurrent : "<<ret<<"\n"; |
DBG(dbg) << "setcurrent : "<<ret<<"\n"; |
320 |
return ret; |
return ret; |