Class: GLSLShader
A GLSLShader is a shader used with WebGL, holds GLSL source code, shader type and hooks for injecting shader variables such as uniforms, attributes etc.
Hierarchy
-
GLSLShader
↳ DefaultPrimitiveFragmentShader
↳ DefaultPrimitiveVertexShader
Implements
Table of contents
Constructors
Properties
Constructors
constructor
+ new GLSLShader(type
: string, source
: string, perShader?
: (context
: GLSLContext) => void, perTexture?
: (context
: GLSLContext, texture
: WebGLTexture) => void, perRenderable?
: (context
: GLSLContext, renderable
: IRenderable, texture?
: WebGLTexture) => void): GLSLShader
Parameters:
Name | Type |
---|---|
type |
string |
source |
string |
perShader? |
(context : GLSLContext) => void |
perTexture? |
(context : GLSLContext, texture : WebGLTexture) => void |
perRenderable? |
(context : GLSLContext, renderable : IRenderable, texture? : WebGLTexture) => void |
Returns: GLSLShader
Properties
perRenderable
• Optional
perRenderable: undefined | (context
: GLSLContext, renderable
: IRenderable, texture?
: WebGLTexture) => void
Hook for injecting variables for the GLSL shader at the per renderable stage of the rendering process, runs once per renderable used, should inject variables for renderable specific variables.
perShader
• Optional
perShader: undefined | (context
: GLSLContext) => void
Hook for injecting variables for the GLSL shader at the per shader stage of the rendering process, runs once per program (grouping of shaders) used, should inject variables for shader specific, but not texture or renderable specific variables.
perTexture
• Optional
perTexture: undefined | (context
: GLSLContext, texture
: WebGLTexture) => void
Hook for injecting variables for the GLSL shader at the per texture stage of the rendering process, runs once per texture used, should inject variables for texture specific, but not renderable specific variables.
source
• source: string
GLSL source code.
Implementation of: IShader.source
type
• type: string
Shader type, vertex or fragment.