[vtkusers] Problems with ElevationFilter

Aaron Boxer boxerab at yahoo.com
Tue Jan 22 16:23:08 EST 2002


Hello,
I am trying to generate a terrain map like the
Hawaii.tcl example from the VTK book.

I would like to generate the map from a memory
array, rather than from disk.

If anyone can see what is wrong with the following
code, I would greatly appreciate it. What I get when I
run it is a white window.


vtkDataSetMapper* hawaiiMapper =
vtkDataSetMapper::New();

vtkFloatArray* array = vtkFloatArray::New();
array->SetNumberOfComponents(3);

float *ptr = ((vtkFloatArray
*)array)->WritePointer(0,3*256*256);
for (long i = 0; i < 256; ++i)
{
	for (long j = 0; j < 256; ++j)
	{
	for (long k = 0; k < 3; ++k)
	{
		ptr[3 * (i + j * 256) ] = i;
		ptr[3 * (i + j * 256) + 1 ] = j;
		ptr[3 * (i + j * 256)  + 2] = j;
	}
   }
}



    vtkPoints *points=vtkPoints::New();
    points->SetData(array);
    array->Delete();
  

   vtkPolyData* polyData = vtkPolyData::New();
   polyData->SetPoints(points);
    points->Delete();




vtkElevationFilter* elevation =
vtkElevationFilter::New();
    elevation->SetInput(polyData );
    elevation->SetLowPoint( 0, 0, 0);
    elevation->SetHighPoint( 0, 0, 200);
    elevation->SetScalarRange( 0, 255);

hawaiiMapper->SetInput(elevation->GetOutput());
hawaiiMapper->SetScalarRange( 0, 255);
hawaiiMapper->SetLookupTable(satLut);
vtkActor* hawaiiActor = vtkActor::New();
hawaiiActor->SetMapper( hawaiiMapper);

.
.
.
// add actor to renderer
		

Thanks!
Aaron
boxerab at NOSPAMyahoo.com

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



More information about the vtkusers mailing list