[vtkusers] Strange behavior with colors
Laurent
l.paul at uclouvain.be
Mon Jan 24 10:57:09 EST 2011
Dear all,
I'm displaying some actors in my 3D scene most of all PolyData. I have a
problem setting the color of one of them. I first create the shape
(superquadric), display it after a transform, using a vtkProperty and the
method SetColor(1.0,0.0,0.0). It works.
Then, I just modify the transform matrix and the polydata appear in dark
grey. If I strongly zoom in, the shape seems very dark (something like
SetColor(0.1,0.1,0.1)) with a thin red highlight. Here is my code:
//Creation and display
m_SuperQuadricGuide = vtkSuperquadricSource::New();
m_SuperQuadricGuide->ToroidalOff();
m_SuperQuadricGuide->SetPhiResolution(50);
m_SuperQuadricGuide->SetPhiRoundness(0.50);
m_SuperQuadricGuide->SetThetaResolution(50);
m_SuperQuadricGuide->SetThetaRoundness(0.50);
m_SuperQuadricGuide->SetSize(0.50);
m_SuperQuadricGuide->SetScale(m_BoxWidget->GetXWidth()
,m_BoxWidget->GetYWidth(), m_BoxWidget->GetHeight());
m_GuideShapeTransform = vtkTransform::New();
m_GuideShapeTransform->SetMatrix(m_BoxWidget->GetHapticTransform());
m_GuideShapeTransformFilter = vtkTransformPolyDataFilter::New();
m_GuideShapeTransformFilter->SetTransform(m_GuideShapeTransform);
m_GuideShapeTransformFilter->SetInput(m_SuperQuadricGuide->GetOutput());
m_GuideMapper = vtkPolyDataMapper::New();
m_GuideMapper->SetInput(m_GuideShapeTransformFilter->GetOutput());
m_GuideMapper->ScalarVisibilityOff();
m_GuideProperty = vtkProperty::New();
m_GuideProperty->SetColor(1.0,0.0,0.0);
m_GuideProperty->SetOpacity(0.7);
m_GuideActor = vtkActor::New();
m_GuideActor->SetMapper(m_GuideMapper);
m_GuideActor->SetProperty(m_GuideProperty);
//in a second method, I modify the matrix
m_GuideShapeTransform->SetMatrix(m_BoxWidget->GetHapticTransform());
m_SuperQuadricGuide->SetScale(m_BoxWidget->GetXWidth(),
m_BoxWidget->GetYWidth(), m_BoxWidget->GetHeight());
I tried several things such as FrontfaceCullingOn/Off BackfaceCullingOn/Off,
shadeOn/Off etc...
I have displayed the color values and everything is ok.
Is someone has an idea?
I can provide a screenshot if needed.
Thanks,
Laurent.
--
View this message in context: http://vtk.1045678.n5.nabble.com/Strange-behavior-with-colors-tp3354870p3354870.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list