Vizard 7 » Command Index » Vizard objects » node3d » <node3d>.apply
7.7

<node3d>.apply

Apply a shader program to the node

<node3d>.apply(  
program  
node = ''  
op = viz.OP_DEFAULT  
)  
program
This can be one of the following:

Vertex Program
Fragment Program
Shader
Uniform
Effect
EffectComposer
node = ''
The name of the subnode to apply the program to. If the value empty then the program will be applied to the entire node.
op = viz.OP_DEFAULT
Can be viz.OP_DEFAULT to use the nodes default op mode or a combination of the following values:

Op modes

viz.OP_TRAVERSE

When performing an operation on a node, traverse the entire subgraph and process all subnodes as well. This is the default value.

viz.OP_OVERRIDE

When applying attributes, have them override attributes of subnodes.

viz.OP_ROOT

When performing an operation on the node, start at the root transform of the node, instead of the model. Processing the root will include all child Vizard nodes.

Remarks

This command will apply a shader program to the node.

Return Value

None

Example

#Add a fragment program
shader = viz.addShader( frag ='blend.fp' )

#Add some 3d model
node = viz.add('object.wrl')

#Apply fragment program to the model
node.apply(shader)

See also

<node3d>.unapply
<viz>.addEffect
<viz>.addShader
<viz>.addUniformBool
<viz>.addUniformFloat
<viz>.addUniformInt