<div>Sorry I attached wrong code. Here is the function</div>
<div>void CVTKDialogDlg::ShowLandmarks(double current_mode[][3])<br>{<br> CRect rect;<br> CWnd* p = GetDlgItem(IDC_SHOW_FACE);<br> p->GetClientRect(&rect);</div>
<div> </div>
<div> int index;<br> double x, y, z;</div>
<div> for (int i = 0; i < sizeof(landmarks)/sizeof(double); i++)<br> {<br> index = landmarks[i];<br> x = current_mode[index][0];<br> y = current_mode[index][1];<br> z = current_mode[index][2];<br> //newpoints->InsertPoint(vtkIdType(i), current_mode[index][0], current_mode[index][1], (current_mode[index][2])+0.2);<br>
newpoints->InsertPoint(vtkIdType(i), x, y, z+0.2);<br> }</div>
<div> newpolydata->SetPoints(newpoints);<br> gf = vtkVertexGlyphFilter::New();<br> gf->AddInput(newpolydata);<br> gf->Update();</div>
<div> newarray = vtkFloatArray::New();<br> for (int j = 0; j < sizeof(landmarks)/sizeof(double); j++)<br> {<br> newarray->InsertTuple1(vtkIdType(j), double(j));<br> }</div>
<div> newpolydata = vtkPolyData::New();<br> newpolydata->GetPointData()->SetScalars(newarray);</div>
<div> newmapper = vtkPolyDataMapper::New();<br> newmapper->SetInputConnection(gf->GetOutputPort());<br> newmapper->SetScalarRange(0, 7);<br> newmapper->SetScalarVisibility(0);</div>
<div> newactor = vtkActor::New();<br> newactor->SetMapper(newmapper);<br> newactor->GetProperty()->SetColor(0.0, 1.0, 0.0);<br> newactor->GetProperty()->SetPointSize(10);</div>
<div> ren->AddActor(newactor);<br> renWin->AddRenderer(ren);<br> renWin->SetParentId(p->m_hWnd);<br> renWin->SetSize(rect.right-rect.left, rect.bottom-rect.top);</div>
<div> ren->Render();<br> renWin->Render();</div>
<div>}</div>
<div> </div>
<div>Yes, I checked it and am sure that it is called as the slider moved.</div>
<div> </div>
<div>It looks like the points moving without refreshing the screen.</div>
<div> </div>
<div>Thank you very much</div>
<div> </div>
<div>Long<br><br></div>
<div class="gmail_quote">2011/10/13 David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="h5">On Thu, Oct 13, 2011 at 12:14 PM, Wenlong Wang <<a href="mailto:scc.wwl@gmail.com">scc.wwl@gmail.com</a>> wrote:<br>> Yes, I put the refresh operations into a indepedent function, the source<br>> code is followed.<br>
><br>> vtkPoints* np = vtkPoints::New();<br>> float sd[5] = {166.58736074271718, 140.66998311271823, 95.52088334400537,<br>> 65.09632977166221, 59.0649201078395};<br>> for (int i = 0; i < 5090; i++)<br>
> {<br>> for (int j = 0; j<3; j++)<br>> {<br>> mode[i][j] = 0.0;<br>> mode[i][j] = mode1[i][j] * x1 * sd[0] + mode2[i][j] * x2 * sd[1] +<br>> mode3[i][j] * x3 * sd[2] + mode4[i][j] * x4 * sd[3] + mode5[i][j] * x5 *<br>
> sd[4] + meanface[i][j];<br>> }<br>> }<br>> for (int k = 0; k< 5090; k++)<br>> {<br>> np->InsertPoint(k, mode[k]);<br>> }<br>><br>> points->DeepCopy(np);<br>><br>> face->SetPoints(points);<br>
> face->SetPolys(poly);<br>> face->GetPointData()->SetScalars(scalars);<br>><br>> faceMapper->SetInput(face);<br>> faceMapper->SetScalarRange(0, 7);<br>> faceMapper->SetScalarVisibility(0);<br>
><br>> faceActor->SetMapper(faceMapper);<br>> faceActor->GetProperty()->SetColor(0.9, 0.9, 0.9);<br>><br>> ren->SetBackground(0.1, 0.2, 0.4);<br>> ren->AddActor(faceActor);<br>> ren->SetActiveCamera(cam);<br>
> ren->ResetCamera();<br>> renWin->AddRenderer(ren);<br>> renWin->SetParentId(p->m_hWnd);<br>> renWin->SetSize(rect.right-rect.left, rect.bottom-rect.top);<br>> iren->SetRenderWindow(renWin);<br>
> renWin->Render();<br>><br><br></div></div>Please keep the conversation on the mailing list. You have not shown<br>there when that function is called - are you sure it is called as the<br>slider is being moved?<br>
<font color="#888888"><br>David<br></font></blockquote></div><br>