Phaser API Documentation

  Version: 
Filter
Namespace: WebGL
Phaser.Types.Renderer.WebGL

Type Definitions

RenderTargetConfig
Focus
Focus
Properties:
name type arguments Default description
scale number <optional> 1

A 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.

minFilter number <optional> 0

The minFilter mode of the texture. 0 is LINEAR, 1 is NEAREST.

autoClear boolean <optional> true

Controls if this Render Target is automatically cleared (via gl.COLOR_BUFFER_BIT) during the bind.

width number <optional>

The width of the Render Target. This is optional. If given it overrides the scale property.

height number <optional> 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
Focus
Focus
WebGLConst
Focus
Focus
Properties:
name type description
enum GLenum

The data type of the attribute, i.e. gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.FLOAT, etc.

size number

The size, in bytes, of the data type.

Type:
object
Since: 3.50.0
Focus
Focus
WebGLPipelineAttribute
Focus
Focus
Properties:
name type description
name string

The name of the attribute as defined in the vertex shader.

size number

The number of components in the attribute, i.e. 1 for a float, 2 for a vec2, 3 for a vec3, etc.

type GLenum

The data type of the attribute. Either gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT or gl.FLOAT.

offset number

The offset, in bytes, of this attribute data in the vertex array. Equivalent to offsetof(vertex, attrib) in C.

normalized boolean

Should the attribute data be normalized?

enabled boolean

You should set this to false by default. The pipeline will enable it on boot.

location number

You should set this to -1 by default. The pipeline will set it on boot.

Type:
object
Focus
Focus
WebGLPipelineAttributeConfig
Focus
Focus
Properties:
name type arguments Default description
name string

The name of the attribute as defined in the vertex shader.

size number

The number of components in the attribute, i.e. 1 for a float, 2 for a vec2, 3 for a vec3, etc.

type Phaser.Types.Renderer.WebGL.WebGLConst

The data type of the attribute, one of the WEBGL_CONST values, i.e. WEBGL_CONST.FLOAT, WEBGL_CONST.UNSIGNED_BYTE, etc.

normalized boolean <optional> false

Should the attribute data be normalized?

Type:
object
Focus
Focus
WebGLPipelineBatchEntry
Focus
Focus
Properties:
name type description
start number

The vertext count this batch entry starts from.

count number

The total number of vertices in this batch entry.

unit number

The current texture unit of the batch entry.

maxUnit number

The maximum number of texture units in this batch entry.

texture Array.<WebGLTexture>

An array of WebGLTexture references used in this batch entry.

Type:
object
Focus
Focus
WebGLPipelineConfig
Focus
Focus
Properties:
name type arguments Default description
game Phaser.Game

The Phaser.Game instance that owns this pipeline.

name string <optional>

The name of the pipeline.

topology GLenum <optional> 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).

vertShader string <optional>

The source code, as a string, for the vertex shader. If you need to assign multiple shaders, see the shaders property.

fragShader string <optional>

The 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.

batchSize number <optional>

The number of quads to hold in the batch. Defaults to RenderConfig.batchSize. This amount * 6 gives the vertex capacity.

vertexSize number <optional>

The size, in bytes, of a single entry in the vertex buffer. Defaults to Float32Array.BYTES_PER_ELEMENT * 6 + Uint8Array.BYTES_PER_ELEMENT * 4.

vertices Array.<number> | Float32Array <optional>

An optional Array or Typed Array of pre-calculated vertices data that is copied into the vertex data.

attributes Array.<Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig> <optional>

An array of shader attribute data. All shaders bound to this pipeline must use the same attributes.

shaders Array.<Phaser.Types.Renderer.WebGL.WebGLPipelineShaderConfig> <optional>

An 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.

forceZero boolean <optional> false

Force the shader to use just a single sampler2d? Set for anything that extends the Single Pipeline.

renderTarget boolean | number | Array.<Phaser.Types.Renderer.WebGL.RenderTargetConfig> <optional>

Create Render Targets for this pipeline. Can be a number, which determines the quantity, a boolean (sets quantity to 1), or an array of Render Target configuration objects.

Type:
object
Focus
Focus
WebGLPipelineShaderConfig
Focus
Focus
Properties:
name type arguments description
name string <optional>

The name of the shader. Doesn't have to be unique, but makes shader look-up easier if it is.

vertShader string <optional>

The source code, as a string, for the vertex shader. If not given, uses the Phaser.Types.Renderer.WebGL.WebGLPipelineConfig.vertShader property instead.

fragShader string <optional>

The 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.

attributes Array.<Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig> <optional>

An array of shader attribute data. All shaders bound to this pipeline must use the same attributes.

Type:
object
Focus
Focus
WebGLPipelineUniformsConfig
Focus
Focus
Properties:
name type arguments description
name string

The name of the uniform as defined in the shader.

location number

The location of the uniform.

value1 number <optional>

The first cached value of the uniform.

value2 number <optional>

The first cached value of the uniform.

value3 number <optional>

The first cached value of the uniform.

value4 number <optional>

The first cached value of the uniform.

Type:
object
Focus
Focus
WebGLTextureCompression
Focus
Focus
Properties:
name type description
ASTC object | undefined

Indicates if ASTC compression is supported (mostly iOS).

ATC object | undefined

Indicates if ATC compression is supported.

BPTC object | undefined

Indicates if BPTC compression is supported.

ETC object | undefined

Indicates if ETC compression is supported (mostly Android).

ETC1 object | undefined

Indicates if ETC1 compression is supported (mostly Android).

IMG object | undefined

Indicates the browser supports true color images (all browsers).

PVRTC object | undefined

Indicates if PVRTC compression is supported (mostly iOS).

RGTC object | undefined

Indicates if RGTC compression is supported (mostly iOS).

S3TC object | undefined

Indicates if S3TC compression is supported on current device (mostly Windows).

S3TCRGB object | undefined

Indicates if S3TCRGB compression is supported on current device (mostly Windows).

Type:
object
Focus
Focus