Maybe try resetting the Camera and the CameraClipping range<br><br><div class="gmail_quote">On Sat, May 29, 2010 at 8:39 AM, Roger Mason <span dir="ltr"><<a href="mailto:rmason@mun.ca">rmason@mun.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hello,<br>
<br>
I have created the following by translation to C++ from a file<br>
PerlinTerrain.py found on the web. The Python version produces and<br>
displays a surface.<br>
<br>
// #includes snipped<br>
int main(int argc, char** argv)<br>
{<br>
<br>
vtkPlane* plane = vtkPlane::New();<br>
<br>
vtkPerlinNoise* p1 = vtkPerlinNoise::New();<br>
p1->SetFrequency(1, 1, 0);<br>
<br>
vtkPerlinNoise* p2 = vtkPerlinNoise::New();<br>
p2->SetFrequency(3, 5, 0);<br>
p2->SetPhase(0.5, 0.5, 0);<br>
<br>
vtkPerlinNoise* p3 = vtkPerlinNoise::New();<br>
p3->SetFrequency(16, 16, 0);<br>
<br>
vtkImplicitSum* sum = vtkImplicitSum::New();<br>
sum->SetNormalizeByWeight(1);<br>
sum->AddFunction(plane);<br>
sum->AddFunction(p1, 0.2);<br>
sum->AddFunction(p2, 0.1);<br>
sum->AddFunction(p3, 0.02);<br>
<br>
vtkSampleFunction* sample = vtkSampleFunction::New();<br>
sample->SetImplicitFunction(sum);<br>
sample->SetSampleDimensions(65, 65, 20);<br>
sample->SetModelBounds(-1, 1, -1, 1, -0.5, 0.5);<br>
sample->ComputeNormalsOff();<br>
<br>
vtkContourFilter* surface = vtkContourFilter::New();<br>
surface->SetInputConnection(sample->GetOutputPort());<br>
surface->SetValue(0, 0.0);<br>
<br>
vtkPolyDataNormals* smooth = vtkPolyDataNormals::New();<br>
smooth->SetInputConnection(surface->GetOutputPort());<br>
smooth->SetFeatureAngle(90);<br>
<br>
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();<br>
mapper->SetInputConnection(smooth->GetOutputPort());<br>
mapper->ScalarVisibilityOff();<br>
<br>
vtkActor* actor = vtkActor::New();<br>
actor->SetMapper(mapper);<br>
actor->GetProperty()->SetColor(0.4, 0.2, 0.1);<br>
<br>
// Create the renderer etc.<br>
vtkRenderer* ren = vtkRenderer::New();<br>
vtkRenderWindow* renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(ren);<br>
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
iren->Initialize();<br>
renWin->Render();<br>
iren->Start();<br>
<br>
// Clean-up snipped<br>
return 0;<br>
}<br>
<br>
The version above compiles without errors or warnings. The window<br>
appears and remains visible. The image seems to be drawn but then<br>
disappears, leaving an empty window.<br>
<br>
This is my first try at using VTK. If anyone can spot my mistake,<br>
please help.<br>
<br>
Thanks,<br>
Roger<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>