Vizard 7 » Command Index » Vizard objects » node3d » <node3d:onthefly>.setTexCoord
7.7

<node3d:onthefly>.setTexCoord

Modify a texture coordinate of an On-The-Fly object

<node3d:onthefly>.setTexCoord(  
index  
[x,y,z]  
unit = 0 # keyword argument
)  
index
0-based index of the vertex. Negative index can also be used to reference from end of vertex list.
[x,y,z]
The new texture coordinate of the vertex. The z component is optional and only used for 3D textures.
unit = 0
The texture unit

Remarks

This command allows you to modify the texture coordinate of a specific vertex in the On-The-Fly object. The index is a number that can start from 0 and go up to, but not including, the number of vertices in the object.

Note: If you are frequently changing the texture coordinate of a vertex, then use the <node3d:onthefly>.dynamic command to speed up rendering.

Return Value

None

Example

#Create a textured triangle
viz.startLayer(viz.TRIANGLES)

viz.texCoord(0,0)
viz.vertex(-1,0,0)

viz.texCoord(0,1)
viz.vertex(1,0,0)

viz.texCoord(1,0)
viz.vertex(0,1,0)

triangle = viz.endLayer()

#Apply a texture
triangle.texture(viz.add('image.jpg'))
.
.
.

#Change the texture coordinate of the first vertex
triangle.setTexCoord(0,1,1)

See also

<node3d:onthefly>.dynamic
<node3d:onthefly>.static
<node3d:onthefly>.setNormal
<node3d:onthefly>.setVertex
<node3d:onthefly>.setVertexColor