c++ - sharing opengl context on different displays using ubuntu -
we have application multiple windows on different screens using 3 graphic cards. each window uses opengl render fonts, images etc... works far, except sharing resources. tried implement (fenster custom class store information context, etc...):
//a list of display names vector<string> displays; displays.push_back(":0.0"); displays.push_back(":0.1"); displays.push_back(":0.2"); displays.push_back(":0.3"); displays.push_back(":0.4"); //and loop them foreach(string dispname in displays): //dummy code static int dblbuf[] = {glx_rgba, glx_depth_size, 16, glx_doublebuffer, none}; display* disp; if(dispname != "default") disp = xopendisplay(dispname.c_str()); else disp = xopendisplay(null); if(disp == null) { cout << "error geting display " << dispname << endl; return null; } cout << "creating window on screen "<< dispname << endl; xvisualinfo *vi = glxchoosevisual(disp, defaultscreen(disp), dblbuf); fenster->display = disp; fenster->window = xcreatesimplewindow(disp, rootwindow(disp, vi->screen), 1, 1, 500, 500, 0, blackpixel (disp, 0), blackpixel(disp, 0)); xsetstandardproperties(fenster->display, fenster->window, "main", "main", none,null, 0, null); xmapwindow(disp, fenster->window); if(fensterlist.size()==0) fenster->glxcontext = glxcreatecontext(disp, vi, null, gl_true); else fenster->glxcontext = glxcreatecontext(fensterlist[0]->display, vi, fensterlist[0]->glxcontext, gl_true); xselectinput(disp, fenster->window, buttonpressmask|keypressmask); glxmakecurrent(disp, fenster->window, fenster->glxcontext); glenable(gl_depth_test); glclearcolor(0.0, 0.0, 0.0, 0.0); xflush(disp); fenster->id = fensterlist.size(); fensterlist.push_back(fenster); fenster->setup();
this compiles fine, produces following error on runtime:
creating window on screen :0.0 creating window on screen :0.1 x error of failed request: badmatch (invalid parameter attributes) major opcode of failed request: 137 (glx) minor opcode of failed request: 3 (x_glxcreatecontext) serial number of failed request: 90 current serial number in output stream: 91
the code works when try create multiple windows on same desktop (using display :0.0).
the system ubuntu 10.10, using proprietary ati driver.
any ideas? possible?
from http://www.opengl.org/sdk/docs/man/xhtml/glxcreatecontext.xml :
badmatch generated if context created not share address space or screen of context specified sharelist.
the spec wording suggests should work if have direct rendering contexts , they're created same process, in practice x server and/or libgl might think differently.
Comments
Post a Comment