A texture size this device can make: the size asked for, or the largest it supports when that is smaller
- The engine sizes the textures it makes itself through this, the shadow maps and the like, so a size a device
does not have falls back instead of failing
size numberPixels across
Clear the canvas or render target to canvasClearColor
Clear out a rectangle area of the WebGL canvas or render target
- In framebuffer pixels from the bottom left: backing store pixels on the canvas, texture pixels in a
render target
x numbery numberwidth numberheight number
Compile WebGL shader of the given type, will throw errors if in debug mode
source stringtype number
- Returns
Flush any sprites still in the buffer and copy the WebGL canvas to a 2D context
context CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D
Create WebGL program with given shaders
vsSource stringfsSource string
- Returns
Create WebGL texture from an image and init the texture settings
Restores the active texture when done
image HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap optionalwrap boolean|Array<number> optional, default falsetrue for REPEAT, false for CLAMP_TO_EDGE, or the WebGL modes across and down
pixelated boolean optionalHard edged or smooth, undefined follows tilesPixelated
- Returns
glDraw(x, y, sizeX, sizeY, angle, uv0X, uv0Y, uv1X, uv1Y, rgba, rgbaAdditive)engineWebGL.js:782Add a sprite to the gl draw list, used by all gl draw functions
x numbery numbersizeX numbersizeY numberangle number optional, default 0uv0X number optional, default 0uv0Y number optional, default 0uv1X number optional, default 1uv1Y number optional, default 1rgba number optionalwhite is -1
rgbaAdditive number optional, default 0black is 0
Add a list of colored points to the gl draw list
points Array<Vector2>Array of Vector2 points in tri strip order
pointColors Array<number>Array of 32-bit integer colors
Add a list of points to the gl draw list
points Array<Vector2>Array of Vector2 points in tri strip order
rgba numberColor as a 32-bit integer
Add an untextured rect to the gl draw list
Zeroes the uvs and rgba so the texture contribution multiplies to 0,
then carries the real color in the additive slot. Works regardless of
which texture is currently bound.
x numbery numbersizeX numbersizeY numberangle numberrgba numbercolor as 32-bit integer
Draw all sprites and clear out the buffer, called automatically by the system whenever necessary
Set anti-aliasing for WebGL canvas
Must be called before engineInit
antialias boolean optional, default true
Set the WebGL render target to the given texture or back to the canvas
- What is drawn into a texture is stored premultiplied, and draws of that texture blend it as such
texture WebGLTexture optionala texture or undefined to use normal glCanvas
clear boolean optional, default falseshould the render target be cleared, to canvasClearColor, CLEAR_BLACK for a transparent one
Set the WebGL texture, called automatically if using multiple textures
- This may also flush the gl buffer resulting in more draw calls and worse performance
texture WebGLTexture
Set WebGL texture data from an image, restores the active texture when done
texture WebGLTextureimage HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmappixelated boolean optionalHard edged or smooth, undefined follows tilesPixelated
Set the wrap mode on an existing WebGL texture
Flushes the current batch only if the texture is the active one
texture WebGLTexturewrap boolean|Array<number> optional, default truetrue for REPEAT, false for CLAMP_TO_EDGE, or the WebGL modes across and
down, like [gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT]
Should WebGL be setup with anti-aliasing? must be set before calling engineInit
The WebGL canvas which appears below the main canvas
WebGL2 context for glCanvas
The largest texture this device makes, in pixels across, 0 until WebGL starts; at least 2048 with WebGL2