Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2012-11-19 0:05

Class SpiderGL.WebGL.Shader

The SpiderGL.WebGL.Shader is the base class for all WebGLShader object wrappers, i.e. SpiderGL.WebGL.Shader and SpiderGL.WebGL.FragmentShader.

Class Summary
Constructor Attributes Constructor Name and Description
 
SpiderGL.WebGL.Shader(gl, target, type, options)
Creates a SpiderGL.WebGL.Shader.
Field Summary
Field Attributes Field Name and Description
 
Gets/Sets if the shader will be compiled automatically whenever the source code is changed.
<static>  
SpiderGL.WebGL.Shader.DEFAULT_AUTO_COMPILE
Default value for SpiderGL.WebGL.Shader#autoCompile.
<readonly>  
Tests if the shader is successfully compiled.
<readonly>  
Tests if the shader is ready to use.
<readonly>  
log
Gets the log output generated by the shader compiler.
 
Gets/Sets the shader source code.
<static>  
SpiderGL.WebGL.Shader.TARGET
Dummy WebGL target for shaders.
Fields borrowed from class SpiderGL.WebGL.ObjectGL:
gl, handle, isValid, target
Fields borrowed from class SpiderGL.Core.ObjectBase:
uid

Method Summary

Method Attributes Method Name and Description
 
bind()
Dummy bind method.
 
Compiles the shader.
 
Destroys the WebGLShader.
 
setSource(src, compile)
Sets the shader source code.
 
Dummy unbind method.
<static>  
SpiderGL.WebGL.Shader.unbind(gl)
Dummy shader unbinding.

Class Detail

SpiderGL.WebGL.Shader(gl, target, type, options)
Creates a SpiderGL.WebGL.Shader. SpiderGL.WebGL.Shader is the base class for WebGLShader object wrappers and must not be directly used.
Parameters:
{WebGLRenderingContext} gl
A WebGLRenderingContext hijacked with SpiderGL.WebGL.Context.hijack.
{number} target
Not used.
{number} type
WebGL shader type.
{object} options Optional
Optional parameters.
{WebGLShader} options.handle Optional
If defined, the provided shader will be wrapped and its source code will be queried to the rendering context. Otherwise an internal shader will be created.
{bool} options.autoCompile Optional, Default: SpiderGL.WebGL.Shader.DEFAULT_AUTO_COMPILE
If true, the shader is automatically compiled whenever its source code changes.
{string} options.source Optional
Shader source code. If autoCompile is true, the shader will be automatically compiled.
See:
autoCompile
source
compile
SpiderGL.WebGL.VertexShader
SpiderGL.WebGL.FragmentShader
SpiderGL.WebGL.Program
SpiderGL.WebGL.ObjectGL

Field Detail

{bool} autoCompile
Gets/Sets if the shader will be compiled automatically whenever the source code is changed.
See:
source
compile
<static> {bool} SpiderGL.WebGL.Shader.DEFAULT_AUTO_COMPILE
Default value for SpiderGL.WebGL.Shader#autoCompile.
Default Value:
true
<readonly> {bool} isCompiled
Tests if the shader is successfully compiled.
See:
isReady
<readonly> {bool} isReady
Tests if the shader is ready to use. A shader is considered ready if it is successfully compiled.
See:
isCompiled
<readonly> {string} log
Gets the log output generated by the shader compiler.
See:
compile
{string} source
Gets/Sets the shader source code. If autoCompile is true, the shader is automatically compiled when the source code string is changed.
See:
setSource
compile
autoCompile
<static> {number} SpiderGL.WebGL.Shader.TARGET
Dummy WebGL target for shaders. It is equal to WebGLRenderingContext.NONE and is provided only for completeness with other WebGL wrappers.
Default Value:
WebGLRenderingContext.NONE

Method Detail

  • bind()
    Dummy bind method. It is provided for simmetry with other WebGL object wrappers.
    See:
    unbind
  • {bool} compile()
    Compiles the shader.
    Returns:
    {bool} True if the shader has been successfully compiled, false otherwise.
    See:
    source
    autoCompile
    log
  • destroy()
    Destroys the WebGLShader. After destruction, the handle is set to null and this object should not be used anymore.
    See:
    SpiderGL.WebGL.ObjectGL#destroy
  • setSource(src, compile)
    Sets the shader source code. If compile is not specified and autoCompile is true, the shader is automatically compiled.
    Parameters:
    {string} src
    The shader source code.
    {bool} compile Optional
    If specified, overrides the value of autoCompile.
    See:
    compile
    autoCompile
  • unbind()
    Dummy unbind method. It is provided for simmetry with other WebGL object wrappers.
    See:
    bind
  • <static> SpiderGL.WebGL.Shader.unbind(gl)
    Dummy shader unbinding. This function does nothing and it is provided only for simmetry with other wrappers.
    Parameters:
    {WebGLRenderingContext} gl
    A WebGLRenderingContext.