Menu - Top - Home - Donate to Me

H3DU.ShaderInfo

Back to documentation index.

H3DU.ShaderInfo([vertexShader], [fragmentShader])

Holds source code for a WebGL shader program. A shader program in WebGL consists of a vertex shader (which processes vertices), and a fragment shader (which processes pixels). Shader programs are specially designed for running on a graphics processing unit, or GPU.

This class also stores semantics and uniform values associated with the shader source code.

Note that this class is not associated with any WebGL context, so the uniform values this object stores is not set for any WebGL context.

Currently, the following attribute names are associated with this object by default:

Currently, the following uniform names are associated with this object by default:

Parameters

Methods

H3DU.ShaderInfo#copy()

Returns a new shader info object with the information in this object copied to that object.

Return Value

Return value. (Type: H3DU.ShaderInfo)

H3DU.ShaderInfo#dispose()

Deprecated: Yes

This method was introduced for compatibility reasons.

(static) H3DU.ShaderInfo.getBasicVertex()

Gets the text of a basic vertex shader.

Return Value

The resulting shader text. (Type: string)

(static) H3DU.ShaderInfo.getDefaultFragment()

Gets the text of the default fragment shader.

Return Value

The resulting shader text. (Type: string)

(static) H3DU.ShaderInfo.getDefaultVertex()

Gets the text of the default vertex shader. Putting "#define SHADING\n" at the start of the return value enables the lighting model.

Return Value

The resulting shader text. (Type: string)

H3DU.ShaderInfo#getFragmentShader()

Gets the text of the fragment shader stored in this object.

Return Value

return value. (Type: string)

H3DU.ShaderInfo#getVertexShader()

Gets the text of the vertex shader stored in this object.

Return Value

return value. (Type: string)

(static) H3DU.ShaderInfo.makeCopyEffect()

Generates source code for a shader program that copies the colors of a texture.

Return Value

The resulting shader program. (Type: H3DU.ShaderInfo)

(static) H3DU.ShaderInfo.makeEdgeDetectEffect()

Generates source code for a shader program that generates a two-color texture showing the source texture's edges.

Return Value

The resulting shader program. (Type: H3DU.ShaderInfo)

(static) H3DU.ShaderInfo.makeEffect(functionCode)

Generates source code for a shader program for applying a raster effect (postprocessing effect) to a texture.

Parameters

Return Value

The resulting shader program. (Type: H3DU.ShaderInfo)

(static) H3DU.ShaderInfo.makeEffectFragment(functionCode)

Generates source code for a fragment shader for applying a raster effect to a texture.

Parameters

Return Value

The source text of the resulting fragment shader. (Type: string)

(static) H3DU.ShaderInfo.makeInvertEffect()

Generates source code for a shader program that inverts the colors of a texture.

Return Value

The resulting shader program. (Type: H3DU.ShaderInfo)

H3DU.ShaderInfo#setSemantic(name, semantic, semanticIndex)

Sets the semantic for a vertex attribute.

Parameters

Return Value

This object. Throws an error if the given semantic is unsupported. (Type: H3DU.ShaderInfo)

H3DU.ShaderInfo#setUniformSemantic(u, sem)

Sets a semantic for the given named uniform.

Parameters

Return Value

This object. (Type: H3DU.ShaderInfo)

H3DU.ShaderInfo#setUniforms(uniforms)

Sets the values of one or more uniforms used by this shader program. Since this object doesn't store a WebGL context, or receive one as input, the uniforms won't be associated with a WebGL context.

Parameters

Return Value

This object. (Type: H3DU.ShaderInfo)

Back to documentation index.