Hello,I need to set the one face of the cell with reversed normal blue,and the another face to red.Test code like this:
#include <vtkVersion.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkPolyData.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSphereSource.h>
int main(int argc, char *argv[])
{
vtkNew<vtkSphereSource> source;
source->SetPhiResolution(10);
source->SetThetaResolution(10);
source->Update();
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(source->GetOutputPort());
mapper->Update();
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
vtkNew<vtkRenderer> ren;
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer(ren);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin);
ren->AddActor(actor);
ren->SetBackground(.2, .3, .4);
for (int id = 0; id < 100; id++)
{
dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput())->ReverseCell(id);
}
actor->GetProperty()->EdgeVisibilityOn();
actor->GetProperty()->SetColor(0, 0, 1);
actor->GetProperty()->SetEdgeColor(1, 1, 1);
vtkProperty *bp = vtkProperty::New();
bp->SetColor(0, 1, 0);
actor->SetBackfaceProperty(bp);
renWin->Render();
iren->Start();
return EXIT_SUCCESS;
}
But two faces of this kind of cell are always show black like this,
even the back face property got set.
So,how to set the different colors for each face of the cell with reversed normal?