Class createjs.WebGLRenderer.Context
				
				
			
				
				
				
					
Defined in:  webgl_renderer.js.
				
			
| Constructor Attributes | Constructor Name and Description | 
|---|---|
| 
							 
								createjs.WebGLRenderer.Context(context)
							 
							An inner class that encapsulates the WebGL API to draw 2D shapes. 
						 | 
					
| Method Attributes | Method Name and Description | 
|---|---|
| 
								 bindFramebuffer(buffer)
								 
								Binds the specified frame buffer. 
							 | 
						|
| 
								 bindTexture(texture)
								 
								Binds the specified texture. 
							 | 
						|
| 
								 clear()
								 
								Clears the drawing buffer (or a framebuffer) bound to this context. 
							 | 
						|
| 
								 createFragmentShader(source)
								 
								Creates a fragment shader and compiles it. 
							 | 
						|
| 
								 createFramebuffer(texture)
								 
								Creates a new frame buffer and binds the specified texture to it. 
							 | 
						|
| 
								 createFrameTexture(width, height, type)
								 
								Creates a texture to be bound to a frame buffer. 
							 | 
						|
| 
								 createProgram(vertex, fragment)
								 
								Creates a shader program. 
							 | 
						|
| 
								 createRectangleBuffer(points)
								 
								Creates an array buffer used by rectangles with the specified values. 
							 | 
						|
| 
								 createShader(type, source)
								 
								Creates a vertex shader or a fragment shader and compiles it. 
							 | 
						|
| 
								 createTexture(image)
								 
								Creates a new texture from an HTMLImageElement object, an HTMLCanvasElement
object, or an HTMLVideoElement object. 
							 | 
						|
| 
								 createVertexShader(source)
								 
								Creates a vertex shader and compiles it. 
							 | 
						|
| 
								 deleteFramebuffer(buffer)
								 
								Deletes a frame buffer. 
							 | 
						|
| 
								 deleteProgram(program)
								 
								Deletes a shader program. 
							 | 
						|
| 
								 deleteRectangleBuffer(buffer)
								 
								Deletes a WebGLBuffer object used by rectangles. 
							 | 
						|
| 
								 deleteShader(shader)
								 
								Deletes a shader. 
							 | 
						|
| 
								 deleteTexture(texture)
								 
								Deletes a texture. 
							 | 
						|
| 
								
								 Disables clipping. 
							 | 
						|
| 
								
								 Draws a rectangle. 
							 | 
						|
| 
								
								 Enables color blending and initializes its equations. 
							 | 
						|
| 
								
								 Enables clipping. 
							 | 
						|
| 
								 getColor(program, key)
								 
								Returns the location to the specified color. 
							 | 
						|
| 
								 getColorMatrix(program, key)
								 
								Retrieves the location to the specified color matrix. 
							 | 
						|
| 
								
								 Returns the WebGLRenderingContext object associated with this object. 
							 | 
						|
| 
								 getId()
								 
								Returns the ID assigned to this context. 
							 | 
						|
| 
								 getPoint(program, key)
								 
								Returns the location to the specified point. 
							 | 
						|
| 
								 getRectangleAttribute(program, key)
								 
								Retrieves the location to an attribute and assigns it to the WebGLBuffer
object currently bound to this context. 
							 | 
						|
| 
								 getTextureType(image)
								 
								Retrieves the texture type for the specified image. 
							 | 
						|
| 
								 getTransform(program, key)
								 
								Retrieves the location to the specified transform. 
							 | 
						|
| 
								 setBlend(operation)
								 
								Sets a blending function that emulates the specified composite operation. 
							 | 
						|
| 
								 setColor(color, red, green, blue, alpha)
								 
								Sets the values of the specified color. 
							 | 
						|
| 
								 setColorMatrix(color, matrix)
								 
								Sets the values to the specified color matrix. 
							 | 
						|
| 
								 setFilter(smoothing)
								 
								Sets the filters of the texture bound to this context. 
							 | 
						|
| 
								 setId(id)
								 
								Sets an ID to this context. 
							 | 
						|
| 
								 setPoint(point, x, y)
								 
								Sets the values of the specified point. 
							 | 
						|
| 
								 setRectangleBuffer(buffer, points)
								 
								Sets the specified values to the array buffer. 
							 | 
						|
| 
								 setTransform(transform, matrix)
								 
								Sets the values to the specified transform. 
							 | 
						|
| 
								 setViewport(width, height)
								 
								Sets the viewport rectangle. 
							 | 
						|
| 
								 updateClip(clip, height)
								 
								Updates the clipping rectangle. 
							 | 
						|
| 
								 updateTexture(image)
								 
								Updates the image of the texture bound to this context. 
							 | 
						|
| 
								 useProgram(program)
								 
								Binds the specified shader program and uses it. 
							 | 
						
					Class Detail
				
				
				
						createjs.WebGLRenderer.Context(context)
				
				
				
					An inner class that encapsulates the WebGL API to draw 2D shapes.
					
				
				
				
				
				
					
						- Parameters:
 - {WebGLRenderingContext} context
 
					Method Detail
				
				
					 
					
					
					
					bindFramebuffer(buffer)
					
					
					
						Binds the specified frame buffer.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLFramebuffer} buffer
 
					
					
					bindTexture(texture)
					
					
					
						Binds the specified texture.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLTexture} texture
 
					
					
					clear()
					
					
					
						Clears the drawing buffer (or a framebuffer) bound to this context.
						
						
					
					
					
					
						
						
						
						
						
						
						
					
					
					{WebGLShader}
					createFragmentShader(source)
					
					
					
						Creates a fragment shader and compiles it.
						
						
					
					
					
					
						
							- Parameters:
 - {string} source
 
- Returns:
 - {WebGLShader}
 
					
					{WebGLFramebuffer}
					createFramebuffer(texture)
					
					
					
						Creates a new frame buffer and binds the specified texture to it.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLTexture} texture
 
- Returns:
 - {WebGLFramebuffer}
 
					
					{WebGLTexture}
					createFrameTexture(width, height, type)
					
					
					
						Creates a texture to be bound to a frame buffer.
						
						
					
					
					
					
						
							- Parameters:
 - {number} width
 - {number} height
 - {number} type
 
- Returns:
 - {WebGLTexture}
 
					
					{WebGLProgram}
					createProgram(vertex, fragment)
					
					
					
						Creates a shader program.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLShader} vertex
 - {WebGLShader} fragment
 
- Returns:
 - {WebGLProgram}
 
					
					{WebGLBuffer}
					createRectangleBuffer(points)
					
					
					
						Creates an array buffer used by rectangles with the specified values.
						
						
					
					
					
					
						
							- Parameters:
 - {Float32Array} points
 
- Returns:
 - {WebGLBuffer}
 
					
					{WebGLShader}
					createShader(type, source)
					
					
					
						Creates a vertex shader or a fragment shader and compiles it.
						
						
					
					
					
					
						
							- Parameters:
 - {number} type
 - {string} source
 
- Returns:
 - {WebGLShader}
 
					
					{WebGLTexture}
					createTexture(image)
					
					
					
						Creates a new texture from an HTMLImageElement object, an HTMLCanvasElement
object, or an HTMLVideoElement object.
						
						
					
					
					
					
						
							- Parameters:
 - {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image
 
- Returns:
 - {WebGLTexture}
 
					
					{WebGLShader}
					createVertexShader(source)
					
					
					
						Creates a vertex shader and compiles it.
						
						
					
					
					
					
						
							- Parameters:
 - {string} source
 
- Returns:
 - {WebGLShader}
 
					
					
					deleteFramebuffer(buffer)
					
					
					
						Deletes a frame buffer.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLFramebuffer} buffer
 
					
					
					deleteProgram(program)
					
					
					
						Deletes a shader program.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 
					
					
					deleteRectangleBuffer(buffer)
					
					
					
						Deletes a WebGLBuffer object used by rectangles.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLBuffer} buffer
 
					
					
					deleteShader(shader)
					
					
					
						Deletes a shader.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLShader} shader
 
					
					
					deleteTexture(texture)
					
					
					
						Deletes a texture.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLTexture} texture
 
					
					
					disableClip()
					
					
					
						Disables clipping.
						
						
					
					
					
					
						
						
						
						
						
						
						
					
					
					
					drawRectangle()
					
					
					
						Draws a rectangle. (This renderer uses a triangle strip as a rectangle.)
						
						
					
					
					
					
						
						
						
						
						
						
						
					
					
					
					enableBlend()
					
					
					
						Enables color blending and initializes its equations.
						
						
					
					
					
					
						
						
						
						
						
						
						
					
					
					
					enableClip()
					
					
					
						Enables clipping.
						
						
					
					
					
					
						
						
						
						
						
						
						
					
					
					{WebGLUniformLocation}
					getColor(program, key)
					
					
					
						Returns the location to the specified color.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 - {string} key
 
- Returns:
 - {WebGLUniformLocation}
 
					
					{WebGLUniformLocation}
					getColorMatrix(program, key)
					
					
					
						Retrieves the location to the specified color matrix.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 - {string} key
 
- Returns:
 - {WebGLUniformLocation}
 
					
					{WebGLRenderingContext}
					getContext_()
					
					
					
						Returns the WebGLRenderingContext object associated with this object.
						
						
					
					
					
					
						
						
						
						
						
							- Returns:
 - {WebGLRenderingContext}
 
					
					{number}
					getId()
					
					
					
						Returns the ID assigned to this context. Returning 0 represents this context
does not have a drawing buffer.
						
						
					
					
					
					
						
						
						
						
						
							- Returns:
 - {number}
 
					
					{WebGLUniformLocation}
					getPoint(program, key)
					
					
					
						Returns the location to the specified point.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 - {string} key
 
- Returns:
 - {WebGLUniformLocation}
 
					
					{number}
					getRectangleAttribute(program, key)
					
					
					
						Retrieves the location to an attribute and assigns it to the WebGLBuffer
object currently bound to this context. (This method expects to be called
after a createRectangleBuffer() call or a setRectangleBuffer() call.)
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 - {string} key
 
- Returns:
 - {number}
 
					
					{number}
					getTextureType(image)
					
					
					
						Retrieves the texture type for the specified image.
						
						
					
					
					
					
						
							- Parameters:
 - {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image
 
- Returns:
 - {number}
 
					
					{WebGLUniformLocation}
					getTransform(program, key)
					
					
					
						Retrieves the location to the specified transform.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program
 - {string} key
 
- Returns:
 - {WebGLUniformLocation}
 
					
					
					setBlend(operation)
					
					
					
						Sets a blending function that emulates the specified composite operation.
This renderer renders only the region inside of a display object to be
rendered, i.e. it does not change its outside. This means it is hard to
emulate composite operations that needs to change the outside of a display
object, e.g. source-in, source-out, etc.
						
						
					
					
					
					
						
							- Parameters:
 - {number} operation
 
					
					
					setColor(color, red, green, blue, alpha)
					
					
					
						Sets the values of the specified color.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLUniformLocation} color
 - {number} red
 - {number} green
 - {number} blue
 - {number} alpha
 
					
					
					setColorMatrix(color, matrix)
					
					
					
						Sets the values to the specified color matrix.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLUniformLocation} color
 - {Float32Array} matrix
 
					
					
					setFilter(smoothing)
					
					
					
						Sets the filters of the texture bound to this context.
						
						
					
					
					
					
						
							- Parameters:
 - {boolean} smoothing
 
					
					
					setId(id)
					
					
					
						Sets an ID to this context.
						
						
					
					
					
					
						
							- Parameters:
 - {number} id
 
					
					
					setPoint(point, x, y)
					
					
					
						Sets the values of the specified point.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLUniformLocation} point
 - {number} x
 - {number} y
 
					
					
					setRectangleBuffer(buffer, points)
					
					
					
						Sets the specified values to the array buffer.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLBuffer} buffer
 - {Float32Array} points
 
					
					
					setTransform(transform, matrix)
					
					
					
						Sets the values to the specified transform.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLUniformLocation} transform
 - {Float32Array} matrix
 
					
					
					setViewport(width, height)
					
					
					
						Sets the viewport rectangle.
						
						
					
					
					
					
						
							- Parameters:
 - {number} width
 - {number} height
 
					
					
					updateClip(clip, height)
					
					
					
						Updates the clipping rectangle. This method converts the given bounding box
(in the HTML coordinate) to a scissor rectangle (in the WebGL coordinate) and
uses the converted rectangle for the scissor test. (WebGL uses the bottom-up
coordinate system for scissor rectangles, i.e. (0,0) represents the
bottom-left corner of a scissor rectangle and (width,height) represents its
top-right corner, respectively.)
						
						
					
					
					
					
						
							- Parameters:
 - {createjs.BoundingBox} clip
 - {number} height
 
					
					
					updateTexture(image)
					
					
					
						Updates the image of the texture bound to this context.
						
						
					
					
					
					
						
							- Parameters:
 - {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image
 
					
					
					useProgram(program)
					
					
					
						Binds the specified shader program and uses it.
						
						
					
					
					
					
						
							- Parameters:
 - {WebGLProgram} program