Scratch for Java

Shaders::add()

Adds a shader. If a shader with the given name already exists, that one is returned instead.

The first shader added is drawn with right away; the ones after it wait until switchTo(String) or next() picks them.

The vertex shader is usually null, which uses Processing's default one. In the browser any other vertex shader is ignored.

Examples

View on GitHub

Syntax

Java

.add(name, fragmentShaderPath, vertexShaderPath)

Parameters

Name Data Type Description
name String a unique name
fragmentShaderPath String the path to the fragment shader
vertexShaderPath String the path to the vertex shader, may be null

Return

Shader

add()

Create Shareable URL

Select Sections