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

Extern

An Extern Game Object is a special type of Game Object that allows you to pass

rendering off to a 3rd party.

When you create an Extern and place it in the display list of a Scene, the renderer will

process the list as usual. When it finds an Extern it will flush the current batch

and prepare a transform matrix which your render function can

take advantage of, if required.

The WebGL context is then left in a 'clean' state, ready for you to bind your own shaders,

or draw to it, whatever you wish to do. This should all take place in the render method.

The correct way to deploy an Extern object is to create a class that extends it, then

override the render (and optionally preUpdate) methods and pass off control to your

3rd party libraries or custom WebGL code there.

The render method is called with this signature:

render(renderer: Phaser.Renderer.WebGL.WebGLRenderer, drawingContext: Phaser.Renderer.WebGL.DrawingContext, calcMatrix: Phaser.GameObjects.Components.TransformMatrix, displayList: Phaser.GameObjects.GameObject[], displayListIndex: number): void.

The displayList and displayListIndex parameters allow you to check

other objects in the display list. This might be convenient for optimizing

operations such as resource management.

Once you've finished, you should free-up any of your resources.

The Extern will then return Phaser state and carry on rendering the display list.

Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of

them are used during rendering unless you take advantage of them in your own render code.

Constructor

new Extern(scene)

Parameters

nametypeoptionaldescription
scenePhaser.SceneNoThe Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.

Scope: static

Extends

Phaser.GameObjects.GameObject
Phaser.GameObjects.Components.Alpha
Phaser.GameObjects.Components.BlendMode
Phaser.GameObjects.Components.Depth
Phaser.GameObjects.Components.Flip
Phaser.GameObjects.Components.Origin
Phaser.GameObjects.Components.ScrollFactor
Phaser.GameObjects.Components.Size
Phaser.GameObjects.Components.Texture
Phaser.GameObjects.Components.Tint
Phaser.GameObjects.Components.Transform
Phaser.GameObjects.Components.Visible

Source: src/gameobjects/extern/Extern.js#L12
Since: 3.16.0

Inherited Methods

From Phaser.Events.EventEmitter:

From Phaser.GameObjects.Components.Alpha:

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.Flip:

From Phaser.GameObjects.Components.Origin:

From Phaser.GameObjects.Components.RenderSteps:

From Phaser.GameObjects.Components.ScrollFactor:

From Phaser.GameObjects.Components.Size:

From Phaser.GameObjects.Components.Texture:

From Phaser.GameObjects.Components.Tint:

From Phaser.GameObjects.Components.Transform:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject:


Inherited Members

From Phaser.GameObjects.Components.Alpha:

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.Flip:

From Phaser.GameObjects.Components.Origin:

From Phaser.GameObjects.Components.ScrollFactor:

From Phaser.GameObjects.Components.Size:

From Phaser.GameObjects.Components.Texture:

From Phaser.GameObjects.Components.Tint:

From Phaser.GameObjects.Components.Transform:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject: