[vtkusers] Texture Mapping with 2D Texture Coordinates

Wenlong Wang scc.wwl at gmail.com
Thu Nov 17 14:24:14 EST 2011


Hi Youpie,

Thank you very much for your reply.

I tried in your way. But the position of the texture doesn't look right.
The image I used is not the original texture map for the model. So I'm
wondering if that causes the failure. Do I have to pre-process the texture
map?

Many thanks!

Long

2011/11/17 youpie <meriadegp at yahoo.fr>

> creat a vtkFloatArray with size of vtkPoints size and associate the good
> coordinate texture for each point.
> After : polydata->getPointData->setTcoord(you vtkFloatArray)
>
> For load the texture, use a vtkTexture and the good vtkReader for you
> picture format vtkPGNReader ( for PGN picture (for instance).
>
>  char* fname1 =
>            vtkTestUtilities::ExpandDataFileName(1, new char*(),
> "myPicture.png");
>
>    vtkPNGReader * imageReader = vtkPNGReader::New();
>    imageReader->SetFileName(fname1);
>
> texture->SetInputConnection(imageReaderRed->GetOutputPort());
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Texture-Mapping-with-2D-Texture-Coordinates-tp4997298p5000665.html
> Sent from the VTK - Users mailing list archive at Nabble.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://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111117/459eeb35/attachment.htm>


More information about the vtkusers mailing list