[vtkusers] vtkCompositeManager + ParallelIso.cxx
Paul McGuinness
mcguinpg at maths.tcd.ie
Tue Aug 5 08:05:14 EDT 2003
Hi Users,
I am taking out vtkOutputPort, vtkInputPort and vtkAppendPolyData from
the ParallelIso.cxx example and replacing them with the functionality of
vtkCompositeManager, but I am getting the error :
ERROR: In
/home/cs/VTK/VTK-4.2.2/Rendering/vtkXOpenGLRenderWindow.cxx, line
1005
vtkXOpenGLRenderWindow (0x8435600): bad X server connection.
ERROR: In
/home/cs/VTK/VTK-4.2.2/Rendering/vtkXOpenGLRenderWindow.cxx, line
166
vtkXOpenGLRenderWindow (0x8435600): bad X server connection.
Does anyone know how to resolve this? I have attached the MyMain
function of the code below. I would be very grateful for you help.
Paul.
void MyMain( vtkMultiProcessController *controller, void *arg )
{
vtkImageReader *reader;
vtkContourFilter *iso;
vtkElevationFilter *elev;
int myid, numProcs;
float val;
int numTris;
char* fname = reinterpret_cast<char*>(arg);
// Obtain the id of the running process and the total
// number of processes
myid = controller->GetLocalProcessId();
numProcs = controller->GetNumberOfProcesses();
// Create the reader, the data file name might have
// to be changed depending on where the data files are.
reader = vtkImageReader::New();
reader->SetDataByteOrderToLittleEndian();
reader->SetDataExtent(0, 63, 0, 63, 1, 93);
reader->SetFilePrefix(fname);
reader->SetDataSpacing(3.2, 3.2, 1.5);
// Iso-surface.
iso = vtkContourFilter::New();
iso->SetInput(reader->GetOutput());
iso->SetValue(0, ISO_START);
iso->ComputeScalarsOff();
iso->ComputeGradientsOff();
// Compute a different color for each process.
elev = vtkElevationFilter::New();
elev->SetInput(iso->GetOutput());
vtkMath::RandomSeed(myid * 100);
val = vtkMath::Random();
elev->SetScalarRange(val, val+0.001);
vtkRenderer *ren = vtkRenderer::New();
vtkRenderWindow *renWindow = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
vtkPolyDataMapper *Mapper = vtkPolyDataMapper::New();
vtkActor *Actor = vtkActor::New();
renWindow->AddRenderer(ren);
iren->SetRenderWindow(renWindow);
ren->SetBackground(1, 1, 1);
renWindow->SetSize( 400, 400);
renWindow->OffScreenRenderingOn();
Mapper->SetInput((vtkPolyData *)elev->GetOutput());
Actor->SetMapper(Mapper);
ren->AddActor(Actor);
renWindow->Render();
vtkCompositeManager* tc = vtkCompositeManager::New();
tc->SetRenderWindow(renWindow);
tc->InitializePieces();
tc->StartInteractor();
ren->Delete();
renWindow->Delete();
iren->Delete();
mapper->Delete();
actor->Delete();
reader->Delete();
iso->Delete();
elev->Delete();
}
More information about the vtkusers
mailing list