[vtkusers] Texture coordinates with VTK 4

Will Schroeder will.schroeder at kitware.com
Fri Jan 25 13:29:43 EST 2002


Hi Wilfrid-

>I am migrating from VTK 3.1 to VTK 4. On 3.1 there was the vtkTCoords
>class to define texture coordinates, which has been replaced by a
>subclass of vtkDataArray. My question is : how do you translate the
>following instruction in VTK 4:
>   tc SetTCoord i x y 0
>which aimed at associating (x,y) texture coordinates for point index i
>Thanks for your help.


There is a FAQ entry: 6.7. Changes in VTK between 3.2 and 4.0. The basic 
idea is that the attribute classes like vtkScalars, vtkNormals, vtkTCoords, 
are removed. Now we use subclasses of vtkDataArray (e.g., vtkFloatArray) 
that are labeled as an attribute type (e.g. Scalars). This is cleaner and 
more flexible.

To your question:
vtkFloatArray *tc = vtkFloatArray::New();
tc SetNumberOfComponents 2; //2D texture
tc SetNumberOfTuples xxxx
tc SetTuple2 x y;
....

Will


William J. Schroeder, Ph.D.
Kitware, Inc.
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 x102 (phone)
1-518-371-3971 (fax)




More information about the vtkusers mailing list