<html><div style='background-color:'><DIV class=RTE>hi</DIV>
<DIV class=RTE>for some reason, i just get a black screen when i run the code below..</DIV>
<DIV class=RTE>I have some random points which i want to display, and color code them somehow - for now i've left them to be color mapped to some constant</DIV>
<DIV class=RTE>so i used unstructured grid and vertex cells to represent the data</DIV>
<DIV class=RTE>whats wrong with the below code??</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>vtkLookupTable *lut = vtkLookupTable::New();<BR>vtkPoints *SampleVolPoints = vtkPoints::New();<BR>vtkUnstructuredGrid *SampleVolGrid = vtkUnstructuredGrid::New();<BR>vtkCellArray *SampleVolCellarray = vtkCellArray::New();<BR>vtkActor *SampleVolUgridactor = vtkActor::New();<BR>vtkDataSetMapper *SampleVolDatasetmapper = vtkDataSetMapper::New();<BR>vtkVertex *SampleVolVertex = vtkVertex::New();<BR>vtkFloatArray *fltarray = vtkFloatArray::New();<BR>vtkFloatArray *cellfltarray = vtkFloatArray::New();<BR>Ren1= vtkRenderer::New();<BR>RenWin = vtkRenderWindow::New();<BR>Iren = vtkRenderWindowInteractor::New(); <BR></DIV>
<DIV class=RTE> int point, pnt[1] ;<BR> float xyz[3];<BR></DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> lut->SetAlphaRange(0,1);<BR> lut->SetHueRange(0, 1);<BR> lut->SetNumberOfColors(256);<BR> lut->SetSaturationRange(0, 1);<BR> lut->SetValueRange(0, 1);<BR> lut->SetTableRange(0,1);<BR> lut->Build();</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>int *vertexTypes = new int[NumSearchPoints];<BR> for ( int k =0; k<NumSearchPoints; k++)<BR> {<BR> vertexTypes[k] = VTK_VERTEX;</DIV>
<DIV class=RTE> }</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>fltarray->SetNumberOfValues(NumSearchPoints);<BR></DIV>
<DIV class=RTE>SampleVolGrid->Allocate(NumSearchPoints); </DIV>
<DIV class=RTE>SampleVolPoints->SetNumberOfPoints(NumSearchPoints);<BR>SampleVolGrid->SetCells(vertexTypes, SampleVolCellarray);</DIV>
<DIV class=RTE> <BR>SampleVolDatasetmapper->SetInput( SampleVolGrid );<BR>SampleVolDatasetmapper->SetLookupTable( lut );<BR>SampleVolDatasetmapper->SetScalarRange(0,2);<BR>SampleVolUgridactor->SetMapper(SampleVolDatasetmapper);</DIV>
<DIV class=RTE>Ren1->AddActor( SampleVolUgridactor );</DIV>
<DIV class=RTE>RenWin->AddRenderer( Ren1 );<BR>RenWin->SetSize( 600, 600 );<BR>RenWin->SetInteractor(Iren);</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>while(1)</DIV>
<DIV class=RTE>{</DIV>
<DIV class=RTE> for ( int point = 0; point<NumSearchPoints; point++)</DIV>
<DIV class=RTE> {</DIV>
<DIV class=RTE> xyz[0] = point/2; //x</DIV>
<DIV class=RTE> xyz[1] = point/3; //y</DIV>
<DIV class=RTE> xyz[2] = point/4; //z</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> pnt[0] = point;<BR> SampleVolPoints->SetPoint(point, xyz); </DIV>
<DIV class=RTE> fltarray->SetValue(point, 1.5);<BR> SampleVolCellarray->InsertNextCell( 1, pnt); <BR> }</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>SampleVolGrid->GetPointData()->SetScalars(fltarray);</DIV>
<DIV class=RTE> <BR>SampleVolDatasetmapper->Update();<BR>Iren->Initialize();<BR>Iren->Render();<BR>Iren->Start(); </DIV>
<DIV class=RTE>} </DIV></div><br clear=all><hr> <a href="http://g.msn.com/8HMBENUS/2755??PS=">Get a FREE online virus check for your PC here, from McAfee.</a> </html>