[vtkusers] vtkSocketController and dataset updates
johnny carroll norris
jnorris at csar.uiuc.edu
Mon May 14 16:23:15 EDT 2001
Hello all,
I'm working on a client-server application where the server produces
polydata and ships it to the client for rendering. I'm using vtkInputPort
and vtkOutputPort with the contrib class vtkSocketController. I've written a
little example to familiarize myself with their use, and it's working well.
The only hitch is that while rotating, the client is constantly querying the
server to see if the polydata needs updating. This causes a very noticable
lag and makes interaction very jerky. Is there an easy way to skip the
checks while interacting? I haven't noticed any convenient methods in
vtkInputPort, but maybe I've missed something. The only thing I can think
of, short of rewriting vtkInputPort, is a small filter that simply passes
polydata from the input to the output, and passes update queries and requests
from the output to the input. This would give me control over whether or not
the update queries ever make it to the vtkInputPort.
Any other suggestions?
Thanks,
John
--
John Norris
Research Programmer
Center for Simulation of Advanced Rockets
http://www.uiuc.edu/ph/www/jnorris
-------------- next part --------------
#include <iostream>
#include <vtkSocketController.h>
#include <vtkOutputPort.h>
#include <vtkConeSource.h>
int main()
{
vtkSocketController *pController = vtkSocketController::New();
pController->WaitForConnection(10101, -1);
vtkConeSource *pSource = vtkConeSource::New();
vtkOutputPort *pPort = vtkOutputPort::New();
pPort->SetController(pController);
pPort->SetTag(2);
pPort->SetInput(pSource->GetOutput());
pSource->Delete();
pController->ProcessRMIs();
cout << "Done!" << endl;
return 0;
}
-------------- next part --------------
#include <vtkSocketController.h>
#include <vtkInputPort.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
int main(int argc, char *argv[])
{
vtkSocketController *pController = vtkSocketController::New();
pController->Initialize(&argc, &argv);
pController->ConnectTo("soot.mcs.anl.gov", 10101);
vtkInputPort *pPort = vtkInputPort::New();
pPort->SetController(pController);
pPort->SetRemoteProcessId(1);
pPort->SetTag(2);
vtkPolyDataMapper *pMapper = vtkPolyDataMapper::New();
pMapper->SetInput(pPort->GetPolyDataOutput());
pPort->Delete();
vtkActor *pActor = vtkActor::New();
pActor->SetMapper(pMapper);
pMapper->Delete();
vtkRenderer *pRenderer = vtkRenderer::New();
pRenderer->AddActor(pActor);
pActor->Delete();
vtkRenderWindow *pWindow = vtkRenderWindow::New();
pWindow->AddRenderer(pRenderer);
pRenderer->Delete();
vtkRenderWindowInteractor *pInteractor = vtkRenderWindowInteractor::New();
pInteractor->SetRenderWindow(pWindow);
pWindow->Render();
pInteractor->Start();
pInteractor->Delete();
pWindow->Delete();
pController->CloseConnection();
pController->Delete();
return 0;
}
More information about the vtkusers
mailing list