Class

WebGL

WebGL()

WebGL renderer

Constructor

Extends

Members

Camera

protected activeCamera

Camera to use for next draw calls and graphics calculs
Inherited From:

View Source Renderers/RenderAPI.js, line 18

Methods

static getInstance()

Get unique instance

View Source Renderers/WebGL/RenderWebGL.js, line 81

applyStateBlock(stateBlock)

Apply the given state block
Parameters:
Name Type Description
stateBlock StateBlock A StateBlock instance
Inherited From:

View Source Renderers/RenderAPI.js, line 33

bindFrameBuffer(framebufferID)

Bind the given framebuffer
Parameters:
Name Type Description
framebufferID number An identifier, -1 to bind default the frame buffer
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 103

bindLight(light)

Bind light
Parameters:
Name Type Description
light Light A Light instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 94

bindTexture(slot, texture)

Bind texture to the the given slot
Parameters:
Name Type Description
slot number Targeted slot's index
texture Private.TextureInterface A Texture instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 124

bindTextureCube(slot, texture)

Bind texture cube to the the given slot
Parameters:
Name Type Description
slot number Targeted slot's index
texture TextureCube A TextureCube instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 200

clear(color)

Clear the rendering target
Parameters:
Name Type Description
color Color A Color instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 248

createFrameBuffer() → {number}

Create a new frame buffer
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 272

An identifier to work with it later
number

drawIndexedPrimitives(drawingMode, firstVertexIndex, vertexCount)

Draw indexed primitives
Parameters:
Name Type Description
drawingMode DrawingMode Drawing mode to use
firstVertexIndex number Index of the first vertex to draw, useful to draw some parts
vertexCount number Vertex count to draw
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 287

drawPrimitives(drawingMode, firstVertexIndex, vertexCount)

Draw primitives
Parameters:
Name Type Description
drawingMode DrawingMode Drawing mode to use
firstVertexIndex number Index of the first vertex to draw, useful to draw some parts
vertexCount number Vertex count to draw
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 299

getActiveCamera() → {Camera}

Get the active camera
Inherited From:

View Source Renderers/RenderAPI.js, line 235

A Camera instance or null
Camera

initFrameBuffer(framebufferID, textures, useDepthBufferopt, useStencilBufferopt)

Init frame buffer: attach it to textures, depth buffer and/or a stencil buffer
Parameters:
Name Type Attributes Default Description
framebufferID number Targeted slot's index
textures Array.<Texture> An array of Texture instances
useDepthBuffer boolean <optional>
true True to use a depth buffer
useStencilBuffer boolean <optional>
false True to use a stencil buffer
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 327

setActiveCamera(camera)

Set camera to use
Parameters:
Name Type Description
camera Camera A Camera instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 493

setBlendMode(blendMode)

Set blend mode to apply
Parameters:
Name Type Description
blendMode BlendMode A BlendMode instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 505

setDepthState(depthTest, writeTest, depthFunction)

Set depth state
Parameters:
Name Type Description
depthTest boolean True to activate depth testing, otherwise false
writeTest boolean True to activate depth writing otherwise false
depthFunction DepthFunction Depth function to apply
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 540

setFaceCulling(mode)

Set face culling state
Parameters:
Name Type Description
mode FaceCulling Face culling mode to set
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 569

setGeometry(geometry)

Set geometry to use
Parameters:
Name Type Description
geometry Geometry A Geometry instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 610

setIndexBuffer(buffer)

Set index buffer to use
Parameters:
Name Type Description
buffer number | WebGLBuffer A buffer instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 601

setProgram(program) → {number}

Set program to use
Parameters:
Name Type Description
program Program A Program instance to use
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 686

-1: an error occured, 0: everything is ok, 1 : program have been changed
number

setScissorTest(state, x, y, w, h)

Set scissor test state
Parameters:
Name Type Description
state boolean True to activate scissor testing, otherwise false
x number Position on x from the left of the screen
y number Position on y from the bottom of the screen
w number Width of the rectangle
h number Height of the rectangle
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 881

setStencilFunction(stencilFunction, reference, mask)

Set stencil function to use
Parameters:
Name Type Description
stencilFunction StencilFunction Function to use
reference number Reference value
mask number Mask to use
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 926

setStencilOperations(sFail, dpFail, dppPass)

Set stencil operations to use
Parameters:
Name Type Description
sFail StencilOperation Function to use
dpFail StencilOperation Reference value
dppPass StencilOperation Mask to use
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 942

setStencilState(activate, writeMask)

Set stencil test state
Parameters:
Name Type Description
activate boolean True to activate stencil test, otherwise false
writeMask number Stencil writing value
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 899

setUniform(program, name, type, value, groupCountopt) → {boolean}

Set uniform value
Parameters:
Name Type Attributes Default Description
program Program A Program instance to use
name string Uniform's name
type Type Type of value to send
value ?Array.<number> | Texture | boolean | number | Float32Array A value
groupCount number <optional>
0 When an element is an array, you can create group (like sub-array)
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 787

True if uniform has been set successfully, otherwise false
boolean

setVertexBuffer(stream, buffer)

Set vertex buffer to use Warning: You must call "setVertexFormat" before!
Parameters:
Name Type Description
stream number An integer representing stream to use
buffer number | WebGLBuffer A buffer instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 961

setVertexFormat(format)

Set vertex format to use
Parameters:
Name Type Description
format VertexFormat A VertexFormat instance
Overrides:

View Source Renderers/WebGL/RenderWebGL.js, line 992