Skip to main content
Version: Phaser v4.0.0-rc.6

Types.Renderer.WebGL

ShaderAdditionConfig

<static> ShaderAdditionConfig

A ShaderAdditionConfig defines an addition to be made to a shader program.

It consists of a name, a set of shader additions, and optional tags.

The name is used as a key to identify the shader addition.

It is used as part of a unique identifier for a shader program.

The shader additions are key-value pairs of strings,

where the key is the template to which the value is added.

This is found in the base shader program source code as

#pragma phaserTemplate(key).

nametypeoptionaldescription
namestringNoThe name of the shader addition, used as a key.
additionsobjectNoThe shader additions to apply. Each addition is a key-value pair of strings, where the key is the template to which the value is added. Keys are applied to both vertex and fragment shader code, if the template exists in both.
tagsArray.<string>YesOptional tags used to describe the shader addition.
disablebooleanYesWhether to ignore this addition while compiling a shader.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/ShaderAdditionConfig.js#L7
Since: 4.0.0


WebGLAttributeLayout

<static> WebGLAttributeLayout

nametypeoptionaldefaultdescription
namestringNoThe name of the attribute, as defined in the shader.
sizenumberNoThe number of components per vertex attribute.
typeGLenum | stringNoThe data type of each component in the array. This can differ from the type in the shader, so long as WebGL can convert the types. If the type is a string, it will be converted to the appropriate GLenum, e.g. 'FLOAT' to gl.FLOAT.
normalizedbooleanNoWhether integer data values should be normalized when being cast to a float.
offsetnumberNoThe byte offset from the beginning of the buffer.
bytesnumberYes4The number of bytes per vertex attribute. This is the size of the type, usually 4 bytes for FLOAT or INT.
columnsnumberYes1The number of columns in the attribute data. Represent matrices as column vectors and increase columns to match the matrix size.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLAttributeBufferLayout.js#L7
Since: 4.0.0


WebGLAttributeBufferLayout

<static> WebGLAttributeBufferLayout

nametypeoptionaldescription
stridenumberNoThe stride of the attribute data.
countnumberNoThe maximum number of elements in the buffer.
usageGLenum | stringNoThe usage pattern of the data store. gl.STATIC_DRAW, gl.DYNAMIC_DRAW or gl.STREAM_DRAW. If the type is a string, it will be converted to the appropriate GLenum, e.g. 'STATIC_DRAW' to gl.STATIC_DRAW.
instanceDivisornumberYesThe instance divisor of the attribute data. This is how many vertices to draw before moving to the next one. It is only used for instanced rendering.
layoutPhaser.Types.Renderer.WebGL.WebGLAttributeLayoutNoThe layout of the attribute data.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLAttributeBufferLayout.js#L20
Since: 4.0.0


WebGLBatchEntry

<static> WebGLBatchEntry

nametypeoptionaldescription
startnumberNoThe vertex count this batch entry starts from.
countnumberNoThe total number of vertices in this batch entry.
unitnumberNoThe current texture unit of the batch entry.
maxUnitnumberNoThe maximum number of texture units in this batch entry.
textureArray.<Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper>NoAn array of WebGLTextureWrapper references used in this batch entry.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLBatchEntry.js#L1
Since: 4.0.0


WebGLBlendParameters

<static> WebGLBlendParameters

nametypeoptionaldescription
enabledGLbooleanYesWhether blending is enabled.
colorArray.<GLclampf>YesThe blend color (RGBA, 0-1).
equationArray.<GLenum>YesThe blend equation. The first value is the RGB equation and the second is the alpha equation.
funcArray.<GLenum>YesThe blend function. The values are srcRGB, dstRGB, srcAlpha, dstAlpha.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLBlendParameters.js#L7
Since: 4.0.0


WebGLConst

<static> WebGLConst

nametypeoptionaldescription
enumGLenumNoThe data type of the attribute, i.e. gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.FLOAT, etc.
sizenumberNoThe size, in bytes, of the data type.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLConst.js#L1
Since: 3.50.0


WebGLGlobalParameters

<static> WebGLGlobalParameters

nametypeoptionaldescription
bindingsobjectYesResources to be bound.
bindings.activeTextureGLintYesThe active texture unit.
bindings.arrayBufferPhaser.Renderer.WebGL.Wrappers.WebGLBufferWrapperYesThe vertex array buffer to bind.
bindings.elementArrayBufferPhaser.Renderer.WebGL.Wrappers.WebGLBufferWrapperYesThe index array buffer to bind.
bindings.framebufferPhaser.Renderer.WebGL.Wrappers.WebGLFramebufferWrapperYesThe framebuffer to bind.
bindings.programPhaser.Renderer.WebGL.Wrappers.WebGLProgramWrapperYesThe program to bind.
bindings.renderbufferWebGLRenderbufferYesThe renderbuffer to bind.
blendPhaser.Types.Renderer.WebGL.WebGLBlendParametersYesThe blend parameters to set.
colorClearValueArray.<Float32Array>YesThe color to clear the color buffer to. 4 elements, RGBA.
colorWritemaskArray.<GLboolean>YesThe color writemask to set. 4 elements, RGBA.
cullFacebooleanYesWhether to enable culling.
depthTestbooleanYesWhether to enable depth testing.
scissorobjectYesScissor parameters to set.
scissor.enablebooleanYesWhether to enable scissoring.
scissor.boxArray.<Int32Array>YesThe scissor rectangle to set. 4 elements, XYWH. Note that these are stored in WebGL format, bottom-up, so the Y coordinate is inverted to screen space.
stencilPhaser.Types.Renderer.WebGL.WebGLStencilParametersYesThe stencil parameters to set.
texturingobjectYesTexture settings to set. These take effect when creating a texture.
texturing.flipYGLbooleanYesShould the texture be flipped on the Y axis?
texturing.premultiplyAlphaGLbooleanYesShould the texture be pre-multiplied alpha?
vaoPhaser.Renderer.WebGL.Wrappers.WebGLVAOWrapperYesVertex Array Object to bind. This controls the vertex attribute state.
viewportArray.<Int32Array>YesThe viewport to set. 4 elements, XYWH.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLGlobalParameters.js#L7
Since: 4.0.0


WebGLStencilParameters

<static> WebGLStencilParameters

nametypeoptionaldescription
enabledGLbooleanYesWhether stencil testing is enabled.
funcobjectYesStencil function parameters.
func.funcGLenumNoThe comparison function.
func.refGLintNoThe reference value for the stencil test.
func.maskGLuintNoThe mask to apply to the stencil test.
opobjectYesStencil operation parameters.
op.failGLenumNoThe operation to perform if the stencil test fails.
op.zfailGLenumNoThe operation to perform if the depth test fails.
op.zpassGLenumNoThe operation to perform if the stencil test passes and the depth test passes or is disabled.
clearGLintYesThe value to clear the stencil buffer to.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLStencilParameters.js#L7
Since: 4.0.0


WebGLTextureCompression

<static> WebGLTextureCompression

nametypeoptionaldescription
ASTCobject | undefinedNoIndicates if ASTC compression is supported (mostly iOS).
ATCobject | undefinedNoIndicates if ATC compression is supported.
BPTCobject | undefinedNoIndicates if BPTC compression is supported.
ETCobject | undefinedNoIndicates if ETC compression is supported (mostly Android).
ETC1object | undefinedNoIndicates if ETC1 compression is supported (mostly Android).
IMGobject | undefinedNoIndicates the browser supports true color images (all browsers).
PVRTCobject | undefinedNoIndicates if PVRTC compression is supported (mostly iOS).
RGTCobject | undefinedNoIndicates if RGTC compression is supported (mostly iOS).
S3TCobject | undefinedNoIndicates if S3TC compression is supported on current device (mostly Windows).
S3TCSRGBobject | undefinedNoIndicates if S3TCSRGB compression is supported on current device (mostly Windows).

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLTextureCompression.js#L1
Since: 3.55.0


WebGLUniform

<static> WebGLUniform

nametypeoptionaldescription
locationGLintNoThe location of the uniform.
typeGLenumNoThe type of the uniform.
sizeGLintNoThe size of the uniform, in elements.
valuenumber | Array.<number>NoThe value of the uniform.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLUniform.js#L7
Since: 4.0.0