[vtkusers] vtkLookupTable GetColor problem

Hikaruchan Sandra.Schroetter.fl at ait.ac.at
Thu Nov 3 13:55:36 EDT 2011


Hi!

I have tried to visualize some vtkPoints. The visualization itself is not
the problem, but the coloring of the vtkPolyData to which the vtkPoints are
set via SetPoints() is tricky. In my init-Funktion the coloring of the
polydata via the lookuptable function GetColor works great.

But when I later change the point-data and the colors, everything gets red.
Here some code:

Thats my LookupTable i use:
	VTKtableVertexCloud = vtkLookupTable::New();
	VTKtableVertexCloud->SetNumberOfColors(500);
	VTKtableVertexCloud->SetTableRange(0,500);
	VTKtableVertexCloud->SetRampToLinear();
	VTKtableVertexCloud->SetHueRange( 0, 0.667);
	VTKtableVertexCloud->Build();

Here the usage of GetColor()-Function in the loop where I prepare my
scalararray:
	for(int i = 0; i < electricDensity.size(); ++i){
		double dcolor[3];
		if(electricDensity[i][startTimeStep].electricDensity >= 1){
		
VTKtableVertexCloud->GetColor(electricDensity[i][startTimeStep].electricDensity,
dcolor);
			
			unsigned char color[3];
			for(unsigned int j = 0; j < 3; j++)
			{
				color[j] = 255 * dcolor[j]/1.0;
			}
                        //thats the vtkUnsignedCharArray
			vertexScalars->InsertNextTupleValue(color);
		}
	}
	vertexPolydata->GetPointData()->SetScalars(vertexScalars);
	vertexPolydata->GetPointData()->Update();
	vertexPolydata->Modified();
	vertexPolydata->Update();

As I said in the init-function that works as expected and I get nice and
correct colored vertices. Then I have a updatefuntion where I do exactly the
same loop as above I get only red vertices, because it seems that the
GetColor-Function returns always red, but the overgiven scalarvalue is not
red, So I do not understand why it works in the init function but not in the
update function. Have anyone an idea for this behavior? I would be very
glad.

dear

Hikaruchan


--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkLookupTable-GetColor-problem-tp4961840p4961840.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list