<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
I'm writing a short program to store a series of scences from an offscreen render window. The following is the code snippet that writes the (offscreen) render window in a series of files as the position of an object moves.<BR>
<BR><FONT size=2>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2> (</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> i=0; i<36; ++i)<BR>
{<BR>
cone->SetCenter(3.0-i*1.0/100.0, -1.0, 0.0);<BR>
mRenWin->Render();<BR>
<BR>
std::stringstream s;<BR>
s << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"C:\\OffScreenTest\\scence"</FONT></FONT><FONT size=2> << i << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>".png"</FONT></FONT><FONT size=2>;<BR>
vtkWindowToImageFilter* w2if = vtkWindowToImageFilter::New();<BR>
w2if->SetInput(mRenWin);<BR>
vtkPNGWriter* wr = vtkPNGWriter::New();<BR>
wr->SetInputConnection(w2if->GetOutputPort());<BR>
wr->SetFileName(s.str().c_str());<BR>
wr->Write();<BR>
}<BR></FONT>
<BR>You can see I have to create new vtkWindowToImageFilter and vtkPNGWriter objects for each iteration inside the loop to save the updated render window. Otherwise, only the screen of the first scene is saved.<BR>
<BR>
What did I do wrong?<BR>
<BR>
Thanks!<BR>
<BR>Xiaofeng Zhao<BR><BR><BR><BR><br /><hr />Insert movie times and more without leaving HotmailŪ. <a href='http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009' target='_new'>See how.</a></body>
</html>