[vtkusers] How do I specify polygon based texture coordinates in VTK 4.n?

Amy Squillacote amy.squillacote at kitware.com
Thu Jul 28 16:33:35 EDT 2005


Hi Mike,

Create a vtkDataArray of the appropriate type for your texture 
coordinates (probably a vtkFloatArray).  Fill in the data array with 
your texture coordinates.  Then make the call 
data->GetPointData()->SetTCoords(tcoords); as mentioned in the e-mail 
below from David Gobbi.  The SetTCoords method now takes a 
vtkDataArray* instead of a vtkTCoords*.

- Amy

At 04:16 PM 7/28/2005, Day, Michael A AMRDEC/UAH wrote:
>Howdy,
>
>The following is a message from a previous question answered by this 
>mailing list.  By my estimate, the vtkTCoord class is absent from 
>the VTK since at least version 4.2.  Is there a different way to use 
>polygonal texture coordinates now?  Note that I am NOT interested in 
>automatic texture mapping (I've already got the texture coordinates, 
>and I'd like to use them).
>
>Thanks,
>
>Mike Day
>
>----------------------------
>
>[vtkusers] Texture mapping
>
>David Gobbi dgobbi at irus.rri.ca
>Fri Jun 29 12:38:49 EDT 2001
>
>
>--------------------------------------------------------------------------------
>
>Hi Remo,
>
>Just set up your points & your polygons so that the triangles don't share
>any points.  Waste a bit of memory, in other words.
>
>  - David
>
>On Fri, 29 Jun 2001, Remo Ziegler wrote:
>
> > Hi David,
> >
> > thanks a lot for your help. Do you know how I can map one 
> 3D-point on several texture-points? The
> > problem is, that every triangle is stored independently from the 
> other in the texture file, so
> > that a 3Dpoint can be mapped on several different positions in 
> the texture file.
> >
> > Thanks a lot for your help again!!
> >
> > Greets .... Remo
> >
> > David Gobbi wrote:
> >
> > > Hi Remo,
> > >
> > > It's about the same in VTK.  In a situation where you already have
> > > the vertices & texture coords, you can build a vtkPolyData like this:
> > >
> > > points = vtkPoints::New();
> > > points->InsertNextPoint(x,y,z)  // repeat for all points
> > > ...
> > >
> > > polys = vtkCellArray::New();
> > > polys->InsertNextCell(n);       // n is number of points in polygon
> > > polys->InsertCellPoint(i);      // i is index into above 'points' list
> > > polys->InsertCellPoint(j);      // etc. for each point in polygon
> > > ...
> > > polys->InsertNextCell(m);       // next polygon
> > > ...
> > >
> > > tcoords = vtkTCoords::New();
> > > tcoords.InsertNextTCoord(tx,ty,0.0); // one tcoord per point
> > > ...
> > >
> > > data = vtkPolyData::New();
> > > data->SetPoints(points);
> > > data->SetPolys(polys);
> > > data->GetPointData()->SetTCoords(tcoords);
> > >
> > > Done!  If you want to set normals for the points, you do it
> > > the same way as for the TCoords.
> > >
> > >  - David
> > >
> > > --
> > >   David Gobbi, MSc                       dgobbi at irus.rri.ca
> > >   Advanced Imaging Research Group
> > >   Robarts Research Institute, University of Western Ontario
> > >
> > > On Fri, 29 Jun 2001, Remo Ziegler wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a vtkPolyData object describing the polygonal  model and a
> > > > bmp-File to describe the texture for it. Since the texture file has a
> > > > certain structure, I want to map every triangle of vtkPolyData to a
> > > > triangle in the bmp-file describing the texture.
> > > > In OpenGL I would use the glTextCoord2f(..., ....); glVertex3f(...,
> > > > ...., ....); construction ... is there any similar stuff in vtk?
> > > >
> > > > Thanks for your help! Have a nice weekend !!
> > > >
> > > > Greets .... Remo
> > > >
> > > >
> > > > _______________________________________________
> > > > This is the private VTK discussion list.
> > > > Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> > > > Follow this link to subscribe/unsubscribe:
> > > > http://public.kitware.com/mailman/listinfo/vtkusers
> > > >
> >
>
>
>
>
>
>--------------------------------------------------------------------------------
>
>
>Previous message: [vtkusers] Texture mapping
>Next message: [vtkusers] How to make PYTHON & VTK run on win2k ??
>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>
>--------------------------------------------------------------------------------
>More information about the vtkusers mailing list
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list