[vtkusers] vtkPainterDeviceAdapter->SendAttribute(vtkPointData::SCALARS, ... ) does not work

zlff 65104355 at qq.com
Wed Jan 1 10:22:03 EST 2014


I have a realtime changing color polydata. Only color is changing for my
object, but if I call polyData->GetPointData()->GetScalars()->Modified(),
vtk painters will pass the whole information to graphics card (color,
vertex, normal etc).
It leads to slow rendering speed.

I am trying to pass the changed color array to graphics card directly via
vtkPainterDeviceAdapter->SendAttribute. But it seems that it does not work.

Any help will be appreciated.

Regards,

Jerry

vtkUnsignedCharArray* c =
vtkUnsignedCharArray::SafeDownCast(polyData->GetPointData()->GetScalars());

// Assign random color.
for(int i = 0 ; i < c->GetNumberOfTuples();++i)
{
	double r = vtkMath::Random(0,255);
	double g = vtkMath::Random(0,255);
	double b = vtkMath::Random(0,255);

	c->SetTuple3(i,r,g,b);
}

unsigned char *colors = c->GetPointer(0);
// Pass new color to graphics card.
device->SendAttribute(vtkPointData::SCALARS, 3, VTK_UNSIGNED_CHAR, colors);

// Render. There we should see the new color, while the result said no new
color.
renWin->Render();



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkPainterDeviceAdapter-SendAttribute-vtkPointData-SCALARS-does-not-work-tp5725182.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list