Vizard 8 » Command Index » Vizard modules » viz » <viz>.addShader
8.1

<viz>.addShader

Add a shader object

<viz>.addShader(  
flag = 0  
vert = None  
frag = None  
geom = None  
uniforms = None  
)  
flag = 0
A combination of any of the following shader flags:

Shader flags

viz.SHADER_TANGENT

The shader will supply a 'Tangent' attribute for each vertex.

viz.SHADER_BINORMAL

The shader will supply a 'Binormal' attribute for each vertex.

vert = None
Filename or code for vertex shader
frag = None
Filename or code for fragment shader
geom = None
Filename or code for geometry shader
uniforms = None
A uniform, or list of uniforms to attach to the shader.

Remarks

A shader object allows applying GLSL shaders to node3d objects. This command will fail if your OpenGL driver does not support GLSL.

Return Value

<shader> object

Example

fragCode = """
void main()
{
    gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
"""

shader = viz.addShader(frag=fragCode)

See also

<node3d>.apply
<viz>.addUniformBool
<viz>.addUniformFloat
<viz>.addUniformInt