me.WebGLRenderer.Compositor(renderer)

new Compositor(renderer)

A WebGL texture Compositor object. This class handles all of the WebGL state
Pushes texture regions into WebGL buffers, automatically flushes to GPU

Parameters:
Name Type Description
renderer me.WebGLRenderer

the current WebGL renderer session

Extends

Members

static, readonly length :Number

The number of quads held in the batch

Methods

static addQuad(texture, key, x, y, w, h)

Add a textured quad

Parameters:
Name Type Description
texture me.video.renderer.Texture

Source texture

key String

Source texture region name

x Number

Destination x-coordinate

y Number

Destination y-coordinate

w Number

Destination width

h Number

Destination height

static clear()

Clear the frame buffer, flushes the composite operations and calls gl.clear()

static createTexture(unit, image, filter, repeatopt, wopt, hopt, bopt, bopt, premultipliedAlphaopt) → {WebGLTexture}

Create a texture from an image

Parameters:
Name Type Attributes Default Description
unit Number

Destination texture unit

image Image | Canvas | ImageData | Array.<UInt8Array> | Array.<Float32Array>

Source image

filter Number

gl.LINEAR or gl.NEAREST

repeat String <optional>
"no-repeat"

Image repeat behavior (see me.ImageLayer#repeat)

w Number <optional>

Source image width (Only use with UInt8Array[] or Float32Array[] source image)

h Number <optional>

Source image height (Only use with UInt8Array[] or Float32Array[] source image)

b Number <optional>

Source image border (Only use with UInt8Array[] or Float32Array[] source image)

b Number <optional>

Source image border (Only use with UInt8Array[] or Float32Array[] source image)

premultipliedAlpha Boolean <optional>
true

Multiplies the alpha channel into the other color channels

Returns:
WebGLTexture -

A texture object

static drawLine(points, lenopt, openopt)

Draw a line

Parameters:
Name Type Attributes Default Description
points Array.<me.Vector2d>

Line vertices

len Number <optional>
points.length

amount of points defined in the points array

open Boolean <optional>
false

Whether the line is open (true) or closed (false)

static drawTriangle(points, lenopt, stripopt)

Draw triangle(s)

Parameters:
Name Type Attributes Default Description
points Array.<me.Vector2d>

vertices

len Number <optional>
points.length

amount of points defined in the points array

strip Boolean <optional>
false

Whether the array defines a serie of connected triangles, sharing vertices

static flush()

Flush batched texture operations to the GPU

static setProjection(w, h)

Sets the projection matrix with the given size

Parameters:
Name Type Description
w Number

WebGL Canvas width

h Number

WebGL Canvas height

static useShader(shader)

Select the shader to use for compositing

Parameters:
Name Type Description
shader me.GLShader

a reference to a GLShader instance

See: