<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello VTK users,<br>I am using VTK 5.0, MS Visual Studio 6.0 and Win Vista.<br>I have the following problem:<br>I want to display a 3D scene in a static control (CStatic) in a dialog box.<br>In the OnInitDialog() of my dialog box class, I insert the code below,<br>but it crashes at the last line, when it's time to delete the renderer window.<br>My question is: am I using SetParentId() correctly?<br>Thank you,<br>Philippe<br>////////////////////////////////////////////////////////////////////////////////////////////////////<br>CStatic *pStatic=(CStatic *)GetDlgItem(IDC_STATIC);<br> vtkConeSource *cone = vtkConeSource::New();<br> cone->SetHeight( 3.0 );<br> cone->SetRadius( 1.0 );<br> cone->SetResolution( 10 );<br> vtkPolyDataMapper *coneMapper =
vtkPolyDataMapper::New();<br> coneMapper->SetInputConnection( cone->GetOutputPort() );<br> vtkActor *coneActor = vtkActor::New();<br> coneActor->SetMapper( coneMapper );<br> <br>vtkRenderer *ren1= vtkRenderer::New();<br> ren1->AddActor( coneActor );<br> ren1->SetBackground( 0.1, 0.2, 0.4 );<br><br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br><br>// Attach the VTK scene to the static control <br>renWin->SetParentId(pStatic->m_hWnd);<br> <br> renWin->AddRenderer( ren1 );<br> renWin->SetSize( 300, 300 );<br><br> renWin->Render();<br> <br> cone->Delete();<br> coneMapper->Delete();<br> coneActor->Delete();<br> ren1->Delete();<br> renWin->Delete();<br></div></div><br>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection
around <br>http://mail.yahoo.com </body></html>