[vtkusers] Polygon colouring
Gib Bogle
g.bogle at auckland.ac.nz
Sun Oct 19 20:43:04 EDT 2014
OK, thanks.
Gib
________________________________________
From: David Thompson [david.thompson at kitware.com]
Sent: Monday, 20 October 2014 1:40 p.m.
To: Gib Bogle
Cc: Bill Lorensen; vtkusers at vtk.org
Subject: Re: [vtkusers] Polygon colouring
Hi Gib,
VTK's mappers treat unsigned char scalars as a special case because long ago colors had to be sent to the rendering API as 3-tuples of red, green, and blue unsigned char values. The VTK mappers are hardwired to deal with this case.
David
On Oct 19, 2014, at 20:27, Gib Bogle <g.bogle at auckland.ac.nz> wrote:
> Thanks Bill. Following David Gobbi's suggestion, I got something working in a similar way to the ColorCellsWithRGB example. But I can't say I fully understand it. Specifically, I don't see why this statement
>
> aPlane->GetOutput()->GetCellData()->SetScalars(cellData);
> or in my code
> polygonPolyData->GetCellData()->SetScalars(colors);
>
> sets the colours. How is it that the vtkUnsignedCharArray is interpreted as providing colours?
>
> Cheers
> Gib
> ________________________________________
> From: Bill Lorensen [bill.lorensen at gmail.com]
> Sent: Monday, 20 October 2014 12:39 a.m.
> To: Gib Bogle
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] Polygon colouring
>
> Gib,
>
> Here are a couple of examples:
> http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCellsWithRGB
> http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCells
>
> Bill
>
> On Sat, Oct 18, 2014 at 10:18 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:
>> I'm rendering a shape using vtkPolyData, i.e. as a collection of polygons.
>> Is there a way to colour each polygon separately?
>>
>> polygonPolyData = vtkSmartPointer<vtkPolyData>::New();
>> polygonPolyData->SetPoints(points);
>> polygonPolyData->SetPolys(polygons);
>> hexmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
>> hexmapper->SetInput(polygonPolyData);
>> hexactor = vtkSmartPointer<vtkActor>::New();
>> hexactor->SetMapper(hexmapper);
>>
>> ren->AddActor(hexactor);
>>
>>
>> Thanks
>> Gib
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list