Methods
(static) createProgram(shaders, opt_attribsopt, opt_locationsopt, opt_errorCallback)
Creates a program, attaches shaders, binds attrib locations, links the
program and calls useProgram.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
shaders |
Array.<WebGLShader>
|
The shaders to attach |
|
opt_attribs |
Array.<string>
|
<optional> |
An array of attribs names. Locations will be assigned by index if not passed in |
opt_locations |
Array.<number>
|
<optional> |
The locations for the. A parallel array to opt_attribs letting you assign locations. |
opt_errorCallback |
module:webgl-utils.ErrorCallback
|
callback for errors. By default it just prints an error to the console |
(static) createProgramFromScripts(gl, shaderScriptIds, opt_attribsopt, opt_locationsopt, opt_errorCallback) → {WebGLProgram}
Creates a program from 2 script tags.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gl |
WebGLRenderingContext
|
The WebGLRenderingContext |
|
shaderScriptIds |
Array.<string>
|
Array of ids of the script |
|
opt_attribs |
Array.<string>
|
<optional> |
An array of attribs names. Locations will be assigned by index if not passed in |
opt_locations |
Array.<number>
|
<optional> |
The locations for the. A parallel array to opt_attribs letting you assign locations. |
opt_errorCallback |
module:webgl-utils.ErrorCallback
|
callback for errors. By default it just prints an error to the console |
Returns:
- Type:
-
WebGLProgram
The created program.
(static) createProgramFromSources(gl, shaderSourcess, opt_attribsopt, opt_locationsopt, opt_errorCallback) → {WebGLProgram}
Creates a program from 2 sources.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gl |
WebGLRenderingContext
|
The WebGLRenderingContext |
|
shaderSourcess |
Array.<string>
|
Array of sources for the |
|
opt_attribs |
Array.<string>
|
<optional> |
An array of attribs names. Locations will be assigned by index if not passed in |
opt_locations |
Array.<number>
|
<optional> |
The locations for the. A parallel array to opt_attribs letting you assign locations. |
opt_errorCallback |
module:webgl-utils.ErrorCallback
|
callback for errors. By default it just prints an error to the console |
Returns:
- Type:
-
WebGLProgram
The created program.
(static) resizeCanvasToDisplaySize(canvas, multiplieropt) → {boolean}
Resize a canvas to match the size its displayed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
canvas |
HTMLCanvasElement
|
The canvas to resize. |
|
multiplier |
number
|
<optional> |
amount to multiply by. |
Returns:
- Type:
-
boolean
true if the canvas was resized.
Type Definitions
ErrorCallback(msg)
Error Callback
Parameters:
Name | Type | Description |
---|---|---|
msg |
string
|
error message. |