-
staticmodule:og/webgl/Handler~Handler.getContext(canvas, contextAttributes){Object}
-
Returns a drawing context on the canvas, or null if the context identifier is not supported.
Name |
Type |
Description |
canvas |
Object
|
HTML canvas object. |
contextAttributes |
Object
|
optional
See canvas.getContext contextAttributes. |
Returns:
-
staticmodule:og/webgl/Handler~Handler.getExtension(gl, name){Object}
-
The return value is null if the extension is not supported, or an extension object otherwise.
Name |
Type |
Description |
gl |
Object
|
WebGl context pointer. |
name |
String
|
Extension name. |
Returns:
-
-
Activate blending.
-
-
Activate depth test.
-
-
Activate face culling.
-
addProgram(program, notActivate){Program}
-
Adds shader program to the handler.
Name |
Type |
Description |
program |
Program
|
Shader program. |
notActivate |
boolean
|
optional
If it's true program will not compile. |
Returns:
Type |
Description |
Program
|
- |
-
-
Adds shader programs to the handler.
Name |
Type |
Description |
programsArr |
Array.<Program>
|
Shader program array. |
-
-
Clearing gl frame.
-
createArrayBuffer(array, itemSize, numItems, usage){Object}
-
Creates ARRAY buffer.
Name |
Type |
Default |
Description |
array |
Array.<number>
|
|
Input array. |
itemSize |
number
|
|
Array item size. |
numItems |
number
|
|
Items quantity. |
usage |
number
|
STATIC_DRAW
|
optional
Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW. |
Returns:
-
createArrayBufferLength(array, itemSize, numItems, usage){Object}
-
Creates ARRAY buffer specific length.
Name |
Type |
Default |
Description |
array |
Array.<number>
|
|
Input array. |
itemSize |
number
|
|
Array item size. |
numItems |
number
|
|
Items quantity. |
usage |
number
|
STATIC_DRAW
|
optional
Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW. |
Returns:
-
createDefaultTexture(params, success)
-
Creates default texture object
Name |
Type |
Description |
params |
Object
|
optional
Texture parameters: |
success |
callback
|
optional
Creation callback |
-
createElementArrayBuffer(array, itemSize, numItems, usage){Object}
-
Creates ELEMENT ARRAY buffer.
Name |
Type |
Default |
Description |
array |
Array.<number>
|
|
Input array. |
itemSize |
number
|
|
Array item size. |
numItems |
number
|
|
Items quantity. |
usage |
number
|
STATIC_DRAW
|
optional
Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW. |
Returns:
-
createEmptyTexture2DExt(width, height, filter, internalFormat, format, type, levels){Object}
-
Creates empty texture.
Name |
Type |
Default |
Description |
width |
Number
|
1
|
optional
Specifies the width of the texture image.. |
height |
Number
|
1
|
optional
Specifies the width of the texture image.. |
filter |
String
|
"NEAREST"
|
optional
Specifies GL_TEXTURE_MIN(MAX)_FILTER texture value. |
internalFormat |
String
|
"RGBA"
|
optional
Specifies the color components in the texture. |
format |
String
|
"RGBA"
|
optional
Specifies the format of the texel data. |
type |
String
|
"UNSIGNED_BYTE"
|
optional
Specifies the data type of the texel data. |
levels |
Number
|
0
|
optional
Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createEmptyTexture_l(width, height){Object}
-
Creates empty LINEAR filtered texture.
Name |
Type |
Description |
width |
number
|
Empty texture width. |
height |
number
|
Empty texture height. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createEmptyTexture_n(width, height){Object}
-
Creates Empty NEAREST filtered texture.
Name |
Type |
Description |
width |
number
|
Empty texture width. |
height |
number
|
Empty texture height. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createStreamArrayBuffer(array, itemSize, numItems, usage){Object}
-
Creates STREAM_DRAW ARRAY buffer.
Name |
Type |
Default |
Description |
array |
Array.<number>
|
|
Input array. |
itemSize |
number
|
|
Array item size. |
numItems |
number
|
|
Items quantity. |
usage |
number
|
STATIC_DRAW
|
optional
Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW. |
Returns:
-
createTexture_a_webgl1(image){Object}
-
Creates ANISOTROPY filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_a_webgl2(image){Object}
-
Creates ANISOTROPY filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_l_webgl1(image){Object}
-
Creates LINEAR filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_l_webgl2(image){Object}
-
Creates LINEAR filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_mm_webgl1(image){Object}
-
Creates MIPMAP filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_mm_webgl2(image){Object}
-
Creates MIPMAP filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_n_webgl1(image){Object}
-
Creates NEAREST filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
createTexture_n_webgl2(image){Object}
-
Creates NEAREST filter texture.
Name |
Type |
Description |
image |
Object
|
Image or Canvas object. |
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
-
Deactivate blending.
-
-
Deactivate depth test.
-
-
Deactivate face cullting.
-
-
-
-
Draw single frame.
Name |
Type |
Description |
now |
number
|
Frame current time milliseconds. |
-
-
Returns screen center coordinates.
Returns:
Type |
Description |
number
|
- |
-
getClientAspect(){number}
-
Returns canvas aspect ratio.
Returns:
Type |
Description |
number
|
- |
-
-
Returns context screen height.
Returns:
Type |
Description |
number
|
- |
-
-
Returns context screen width.
Returns:
Type |
Description |
number
|
- |
-
-
Main function that initialize handler.
-
initializeExtension(extensionStr, showLog){Object}
-
Initialize additional WebGL extensions.
Name |
Type |
Description |
extensionStr |
string
|
Extension name. |
showLog |
boolean
|
Show logging. |
Returns:
-
loadCubeMapTexture(params){Object}
-
Creates cube texture.
Name |
Type |
Description |
params |
Object.<string>
|
Face image urls:
Name |
Type |
Description |
px |
string
|
Positive X or right image url. |
nx |
string
|
Negative X or left image url. |
py |
string
|
Positive Y or up image url. |
ny |
string
|
Negative Y or bottom image url. |
pz |
string
|
Positive Z or face image url. |
nz |
string
|
Negative Z or back image url. |
|
Returns:
Type |
Description |
Object
|
- WebGL texture object. |
-
-
Removes shader program from handler.
Name |
Type |
Description |
name |
String
|
Shader program name. |
-
setFrameCallback(callback)
-
Sets animation frame function.
Name |
Type |
Description |
callback |
callback
|
Frame callback. |
-
-
Sets handler canvas size.
Name |
Type |
Description |
w |
number
|
Canvas width. |
h |
number
|
Canvas height. |
-
setStreamArrayBuffer(array, itemSize, numItems, usage){Object}
-
Load stream ARRAY buffer.
Name |
Type |
Default |
Description |
array |
Array.<number>
|
|
Input array. |
itemSize |
number
|
|
Array item size. |
numItems |
number
|
|
Items quantity. |
usage |
number
|
STATIC_DRAW
|
optional
Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW. |
Returns:
-
-
Starts animation loop.