[vtkusers] Problem Exporting VRML in vtk
Will Ryan
wryan2 at nd.edu
Sat Dec 14 13:27:14 EST 2002
Hi, I'm relatively new to vtk and I have been having this problem with it. What we are doing is running a simulation of cell growth in a chemical field and I have been asked to come up with a function that will capture the screen for later reference. They were previously doing it using the jpegs to do it but the problem with that was that they weren't able to run it in the background then. So I suggested using VRML, and they said that was ok.
Now I'm having a problem getting this Exporter to work correctly. Here is what my code looks like:
void
SciViz::init_screen_capture()
{
renSrc = vtkRendererSource::New();
renSrc->WholeWindowOn();
renSrc->SetInput(renderer);
//imgWriter = vtkJPEGWriter::New();
imgWriter = vtkVRMLExporter::New();
// Set graphics outfile name;
outfile = "output";
outfiletag = ".wrl";
}
SciViz::capture_screen()
{
// Compute image filename
char imNum[16];
// Get step number
int step_num;
if(fromFile)
step_num = step;
else
step_num = simulator.simulationData->evolution;
// Generate file name based on: outfile, step number, and outfiletag
sprintf(imNum,"%d",step_num);
string fname = outfile;
if(step_num <10) {
fname += "000";
}
else if(step_num <100){
fname += "00";
}
else if(step_num <1000){
fname += "0";
}
fname += string(imNum) + outfiletag;
// Only capture once every ten steps.
// Note: the filename generation should be inside this condition.
if(step_num%10==1)
{
// Store screen to image
renSrc->Modified();
// required to capture updated screen
//imgWriter->SetInput(renSrc->GetOutput());
//imgWriter->SetFileName(fname.c_str());
//imgWriter->Write();
imgWriter->SetInput(renWin);
imgWriter->SetFileName(fname.c_str());
imgWriter->Write();
}
}
Where renWin is of type RenderWindow *. The commented out stuff is the old code. Also I am Deleting the imgWriter in another cleanup function we have.
and so anytime I try to run this. I always get the following error at runtime: ERROR: In /afs/nd.edu/user28/izaguirr/Research/vtk/VTK/Rendering/vtkVRMLExporter.cxx, line 108
vtkVRMLExporter (0x1ca3c0): VRML files only support one renderer per window.
I've looked online for what this error means but haven't been able to find anything for a few days. One of the things I don't understand is why I'm only getting this error at runtime.
Anyways, I would appreciate any help.
Will Ryan
University of Notre Dame
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021214/a877981e/attachment.htm>
More information about the vtkusers
mailing list