Class: Cloud5ShaderToy

Cloud5ShaderToy()

Presents visuals generated by a GLSL shader. These visuals can show a visualization of the music, or be sampled to generate notes for Csound to perform.

This class is specifically designed to simplify the use of shaders developed in or adapted from the ShaderToy Web site. Other types of shader also can be used.

Constructor

new Cloud5ShaderToy()

Source:

Members

cloud5_piece

Back reference to the piece, which can be used e.g. to get a reference to Csound.

Source:

shader_parameters_addon

A number of parameters must be up to date at the same time before the shader program can be compiled. These are passed to this property in an object, upon which the shader is compiled and begins to run. The paramameters are:

{
 fragment_shader_addon: code,    \\ Required GLSL code.
 vertex_shader_addon: code,      \\ Has a default value, but may be 
                                 \\ overridden with custom GLSL code.
 pre_draw_frame_function_addon,  \\ Optional JavaScript function to be 
                                 \\ caalled in the animation loop before 
                                 \\ drawing each frame, e.g. for setting 
                                 \\ program uniforms.
 post_draw_frame_function_addon, \\ Optional JavaScript function to called 
                                 \\ the animation loop immediately after 
                                 \\ drawing each frame, e.g. for getting 
                                 \\ attributes or reading buffers.                
}
Source:

Methods

compile_shader()

Actually compiles and links the vertex shader and fragment shader.

Source:

create_shader()

Compiles the shader program, and starts rendering the shader.

Source:

get_uniforms()

Obtains all active uniforms from the compiled GLSL shader. Addons may use these to control the shader.

Source:

prepare_canvas()

Prepares the element's canvas for use by WebGL.

Source:

render_frame(milliseconds)

Called by the browseer to run the shader in an endless loop of animation frames.

Parameters:
Name Type Description
milliseconds number

The time since the start of the loop.

Source:

resize()

Called by the browser when the element is resized.

Source: