Skip to main content
Version: Phaser v3.88.2

Types.Renderer.WebGL

RenderTargetConfig

<static> RenderTargetConfig

nametypeoptionaldefaultdescription
scalenumberYes1A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc.
minFilternumberYes0The minFilter mode of the texture. 0 is LINEAR, 1 is NEAREST.
autoClearbooleanYestrueControls if this Render Target is automatically cleared (via gl.COLOR_BUFFER_BIT) during the bind.
autoResizebooleanYesfalseControls if this Render Target is automatically resized when the Renderer resizes.
widthnumberYesThe width of the Render Target. This is optional. If given it overrides the scale property.
heightnumberYes"width"The height of the Render Target. This is optional. If not given, it will be set to the same as the width value.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/RenderTargetConfig.js#L1
Since: 3.50.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


WebGLPipelineAttribute

<static> WebGLPipelineAttribute

nametypeoptionaldescription
namestringNoThe name of the attribute as defined in the vertex shader.
sizenumberNoThe number of components in the attribute, i.e. 1 for a float, 2 for a vec2, 3 for a vec3, etc.
typeGLenumNoThe data type of the attribute. Either gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT or gl.FLOAT.
offsetnumberNoThe offset, in bytes, of this attribute data in the vertex array. Equivalent to offsetof(vertex, attrib) in C.
normalizedbooleanNoShould the attribute data be normalized?
enabledbooleanNoYou should set this to false by default. The pipeline will enable it on boot.
locationnumber | Phaser.Renderer.WebGL.Wrappers.WebGLAttribLocationWrapperNoYou should set this to -1 by default. The pipeline will set it on boot.

Type: object

Member of: Phaser.Types.Renderer.WebGL

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


WebGLPipelineAttributeConfig

<static> WebGLPipelineAttributeConfig

nametypeoptionaldefaultdescription
namestringNoThe name of the attribute as defined in the vertex shader.
sizenumberNoThe number of components in the attribute, i.e. 1 for a float, 2 for a vec2, 3 for a vec3, etc.
typePhaser.Types.Renderer.WebGL.WebGLConstNoThe data type of the attribute, one of the WEBGL_CONST values, i.e. WEBGL_CONST.FLOAT, WEBGL_CONST.UNSIGNED_BYTE, etc.
normalizedbooleanYesfalseShould the attribute data be normalized?

Type: object

Member of: Phaser.Types.Renderer.WebGL

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


WebGLPipelineBatchEntry

<static> WebGLPipelineBatchEntry

nametypeoptionaldescription
startnumberNoThe vertext 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/WebGLPipelineBatchEntry.js#L1
Since: 3.60.0


WebGLPipelineConfig

<static> WebGLPipelineConfig

nametypeoptionaldefaultdescription
gamePhaser.GameNoThe Phaser.Game instance that owns this pipeline.
namestringYesThe name of the pipeline.
topologyGLenumYes"gl.TRIANGLES"How the primitives are rendered. The default value is GL_TRIANGLES. Here is the full list of rendering primitives: (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
vertShaderstringYesThe source code, as a string, for the vertex shader. If you need to assign multiple shaders, see the shaders property.
fragShaderstringYesThe source code, as a string, for the fragment shader. Can include %count% and %forloop% declarations for multi-texture support. If you need to assign multiple shaders, see the shaders property.
batchSizenumberYesThe number of quads to hold in the batch. Defaults to RenderConfig.batchSize. This amount * 6 gives the vertex capacity.
vertexSizenumberYesThe size, in bytes, of a single entry in the vertex buffer. Defaults to Float32Array.BYTES_PER_ELEMENT * 6 + Uint8Array.BYTES_PER_ELEMENT * 4.
verticesArray.<number> | Float32ArrayYesAn optional Array or Typed Array of pre-calculated vertices data that is copied into the vertex data.
attributesArray.<Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig>YesAn array of shader attribute data. All shaders bound to this pipeline must use the same attributes.
shadersArray.<Phaser.Types.Renderer.WebGL.WebGLPipelineShaderConfig>YesAn array of shaders, all of which are created for this one pipeline. Uses the vertShader, fragShader, attributes and uniforms properties of this object as defaults.
forceZerobooleanYesfalseForce the shader to use just a single sampler2d? Set for anything that extends the Single Pipeline.
renderTargetboolean | numberArray.<Phaser.Types.Renderer.WebGL.RenderTargetConfig>Yes
resizeUniformstringYes"''"If the WebGL renderer resizes, this uniform will be set with the new width and height values as part of the pipeline resize call.

Type: object

Member of: Phaser.Types.Renderer.WebGL

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


WebGLPipelineShaderConfig

<static> WebGLPipelineShaderConfig

nametypeoptionaldescription
namestringYesThe name of the shader. Doesn't have to be unique, but makes shader look-up easier if it is.
vertShaderstringYesThe source code, as a string, for the vertex shader. If not given, uses the Phaser.Types.Renderer.WebGL.WebGLPipelineConfig.vertShader property instead.
fragShaderstringYesThe source code, as a string, for the fragment shader. Can include %count% and %forloop% declarations for multi-texture support. If not given, uses the Phaser.Types.Renderer.WebGL.WebGLPipelineConfig.fragShader property instead.
attributesArray.<Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig>YesAn array of shader attribute data. All shaders bound to this pipeline must use the same attributes.

Type: object

Member of: Phaser.Types.Renderer.WebGL

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


WebGLPipelineUniformsConfig

<static> WebGLPipelineUniformsConfig

nametypeoptionaldescription
namestringNoThe name of the uniform as defined in the shader.
locationnumberNoThe location of the uniform.
setterfunctionNoThe setter function called on the WebGL context to set the uniform value.
value1numberYesThe first cached value of the uniform.
value2numberYesThe first cached value of the uniform.
value3numberYesThe first cached value of the uniform.
value4numberYesThe first cached value of the uniform.

Type: object

Member of: Phaser.Types.Renderer.WebGL

Source: src/renderer/webgl/typedefs/WebGLPipelineUniformsConfig.js#L1
Since: 3.55.1


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