mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
fixed mpi-parallel visualization; added warning in mvdraw if running in parallel and direct rendering is enabled (which probably breaks parallel visualization)
This commit is contained in:
parent
49aa2861d6
commit
d778d9dcef
@ -776,13 +776,16 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
string displname;
|
string displname;
|
||||||
|
|
||||||
// Display * dpy = glXGetCurrentDisplay();
|
Display * dpy = glXGetCurrentDisplay();
|
||||||
GLXDrawable drawable = glXGetCurrentDrawable();
|
GLXDrawable drawable = glXGetCurrentDrawable();
|
||||||
GLXContext ctx = glXGetCurrentContext();
|
GLXContext ctx = glXGetCurrentContext();
|
||||||
GLXContextID xid = glXGetContextIDEXT (ctx);
|
GLXContextID xid = glXGetContextIDEXT (ctx);
|
||||||
|
|
||||||
displname = XDisplayName (0);
|
displname = XDisplayName (0);
|
||||||
|
|
||||||
|
if( glXIsDirect ( dpy, ctx ) )
|
||||||
|
cout << "WARNING: direct rendering enabled; this might break mpi-parallel netgen (especially if X-forwarding is used! (to disable, change -indirect to true in ng/drawing.tcl)" << endl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cout << "Init Parallel GL" << endl;
|
cout << "Init Parallel GL" << endl;
|
||||||
cout << "DisplayName = " << displname << endl;
|
cout << "DisplayName = " << displname << endl;
|
||||||
|
@ -77,7 +77,6 @@ void ParallelRun()
|
|||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
message = MyMPI_RecvCmd();
|
message = MyMPI_RecvCmd();
|
||||||
|
|
||||||
if ( message.compare(0, 3, "ngs") == 0 )
|
if ( message.compare(0, 3, "ngs") == 0 )
|
||||||
{
|
{
|
||||||
// PrintMessage ( 1, "Starting NgSolve routine ", message ) ;
|
// PrintMessage ( 1, "Starting NgSolve routine ", message ) ;
|
||||||
@ -156,8 +155,6 @@ void ParallelRun()
|
|||||||
MyMPI_Recv (contextid, 0, MPI_TAG_VIS);
|
MyMPI_Recv (contextid, 0, MPI_TAG_VIS);
|
||||||
|
|
||||||
display = XOpenDisplay (displname.c_str());
|
display = XOpenDisplay (displname.c_str());
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PrintMessage (3, "displ - name = ", displname);
|
PrintMessage (3, "displ - name = ", displname);
|
||||||
PrintMessage (3, "display = ", display,
|
PrintMessage (3, "display = ", display,
|
||||||
@ -166,23 +163,26 @@ void ParallelRun()
|
|||||||
" , h = ", XDisplayHeight (display, 0));
|
" , h = ", XDisplayHeight (display, 0));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Window win;
|
// Window win;
|
||||||
int wx, wy;
|
// int wx, wy;
|
||||||
unsigned int ww, wh, bw, depth;
|
// unsigned int ww, wh, bw, depth;
|
||||||
// cout << "got drawable: " << curDrawable << endl;
|
// cout << "got drawable: " << curDrawable << ", contextid: " << contextid << endl;
|
||||||
|
|
||||||
XGetGeometry(display, curDrawable, &win,
|
// cout << "get geometriy..." << endl;
|
||||||
&wx, &wy, &ww, &wh,
|
// XGetGeometry(display, curDrawable, &win,
|
||||||
&bw, &depth);
|
// &wx, &wy, &ww, &wh,
|
||||||
|
// &bw, &depth);
|
||||||
|
// cout << "have!" << endl;
|
||||||
|
|
||||||
|
// cout << "P" << id << ": window-props: x = " << wx << ", y = " << wy
|
||||||
|
// << ", w = " << ww << ", h = " << wh << ", depth = " << depth << endl;
|
||||||
|
|
||||||
/*
|
|
||||||
cout << "P" << id << ": window-props: x = " << wx << ", y = " << wy
|
|
||||||
<< ", w = " << ww << ", h = " << wh << ", depth = " << depth << endl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define VISUAL
|
#define VISUAL
|
||||||
#ifdef VISUAL
|
#ifdef VISUAL
|
||||||
|
|
||||||
|
#ifdef VISINFO_OLD
|
||||||
|
//this does not seem to work anymore (but might still be with togl1.7?)
|
||||||
// make a new GLXContext
|
// make a new GLXContext
|
||||||
// first, generate a visual (copied from togl)
|
// first, generate a visual (copied from togl)
|
||||||
|
|
||||||
@ -222,19 +222,28 @@ void ParallelRun()
|
|||||||
|
|
||||||
attrib_list[attrib_count++] = None;
|
attrib_list[attrib_count++] = None;
|
||||||
|
|
||||||
|
{
|
||||||
|
int hi = 0;
|
||||||
|
std::cout << "min attribs = ";
|
||||||
|
while (attrib_list[hi] != None)
|
||||||
|
std::cout << attrib_list[hi++] << " ";
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << "choose visual!!" << endl;
|
||||||
|
visinfo = NULL;
|
||||||
visinfo = glXChooseVisual(display, 0,
|
visinfo = glXChooseVisual(display, 0,
|
||||||
attrib_list);
|
attrib_list);
|
||||||
|
cout << "have vis?" << endl;
|
||||||
if (visinfo) {
|
if (visinfo) {
|
||||||
/* found a GLX visual! */
|
/* found a GLX visual! */
|
||||||
// cout << "found VISINFO !!!" << endl;
|
cout << "found VISINFO !!!" << endl;
|
||||||
|
|
||||||
/*
|
int hi = 0;
|
||||||
int hi = 0;
|
std::cout << "attribs = ";
|
||||||
std::cout << "attribs = ";
|
while (attrib_list[hi] != None)
|
||||||
while (attrib_list[hi] != None)
|
|
||||||
std::cout << attrib_list[hi++] << " ";
|
std::cout << attrib_list[hi++] << " ";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
*/
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -242,23 +251,36 @@ void ParallelRun()
|
|||||||
if (!visinfo)
|
if (!visinfo)
|
||||||
cerr << "no VISINFO found" << endl;
|
cerr << "no VISINFO found" << endl;
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
//get all confs
|
||||||
|
int nconfs;
|
||||||
|
auto cptr = glXGetFBConfigs (display,0, &nconfs);
|
||||||
|
cout << "found " << nconfs << " valid confs " << endl;
|
||||||
|
Array<int> conf_ids(nconfs);
|
||||||
|
for(int k=0;k<nconfs;k++)
|
||||||
|
glXGetFBConfigAttrib(display, cptr[k], GLX_FBCONFIG_ID, &(conf_ids[k]));
|
||||||
|
|
||||||
|
//get drawable->FBConfig->visual and try with that
|
||||||
|
unsigned int d_fbc_id;
|
||||||
|
glXQueryDrawable( display, curDrawable, GLX_FBCONFIG_ID, &d_fbc_id);
|
||||||
|
GLXFBConfig d_fbc;
|
||||||
|
for(int k=0;k<nconfs;k++)
|
||||||
|
if(d_fbc_id==conf_ids[k])
|
||||||
|
d_fbc = cptr[k];
|
||||||
|
visinfo = glXGetVisualFromFBConfig(display,d_fbc);
|
||||||
|
#endif
|
||||||
|
|
||||||
// context = glXCreateContext( display, visinfo, 0, /* curContext, */ False );
|
// context = glXCreateContext( display, visinfo, 0, /* curContext, */ False );
|
||||||
context = glXCreateContext( display, visinfo, glXImportContextEXT ( display, contextid ), False);
|
context = glXCreateContext( display, visinfo, glXImportContextEXT ( display, contextid ), False);
|
||||||
// cout << "context = " << context << endl;
|
|
||||||
|
|
||||||
glXMakeCurrent (display, curDrawable, context);
|
glXMakeCurrent (display, curDrawable, context);
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// try to get GLXcontext from the master.
|
// try to get GLXcontext from the master.
|
||||||
// this needs an indirect context (BUT DOES NOT WORK ????)
|
// this needs an indirect context (BUT DOES NOT WORK ????)
|
||||||
|
|
||||||
context = glXImportContextEXT ( display, contextid );
|
context = glXImportContextEXT ( display, contextid );
|
||||||
|
|
||||||
|
//PrintMessage (1, "GLX-contextid = " , contextid,
|
||||||
PrintMessage (1, "GLX-contextid = " , contextid,
|
// " imported context ", context);
|
||||||
" imported context ", context);
|
|
||||||
|
|
||||||
|
|
||||||
glXMakeCurrent (display, curDrawable, context);
|
glXMakeCurrent (display, curDrawable, context);
|
||||||
#endif
|
#endif
|
||||||
@ -283,7 +305,6 @@ void ParallelRun()
|
|||||||
vsmesh.BuildFilledList (false);
|
vsmesh.BuildFilledList (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (redraw_cmd == "solsurfellist")
|
if (redraw_cmd == "solsurfellist")
|
||||||
{
|
{
|
||||||
vssolution.DrawSurfaceElements();
|
vssolution.DrawSurfaceElements();
|
||||||
|
Loading…
Reference in New Issue
Block a user