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

<node3d:onthefly>.setVertexColor

Modify a vertex color of an On-The-Fly object

<node3d:onthefly>.setVertexColor(  
index  
[r,g,b,a]  
)  
index
0-based index of the vertex. Negative index can also be used to reference from end of vertex list.
[r,g,b,a]
The new color of the vertex

Remarks

This command allows you to modify the color 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 color of a vertex, then use the <node3d:onthefly>.dynamic command to speed up rendering.

Return Value

None

Example

#Create a red triangle
viz.startLayer(viz.LINE_LOOP)
viz.vertexColor(viz.RED)
viz.vertex(-1,0,0)
viz.vertex(1,0,0)
viz.vertex(0,1,0)
triangle = viz.endLayer()

.
.
.

#Change the color of the tip to green
triangle.setVertexColor(2,viz.GREEN)

See also

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