# Class: RenderTexture

## Phaser. RenderTexture

Phaser.RenderTexture

#### new RenderTexture(game, key, width, height, key, scaleMode)

  A RenderTexture is a special texture that allows any displayObject to be rendered to it.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `game` | Phaser.Game |  |  | Current game instance.
  `key` | string |  |  | Internal Phaser reference key for the render texture.
  `width` | number | <optional> | 100 | The width of the render texture.
  `height` | number | <optional> | 100 | The height of the render texture.
  `key` | string | <optional> | '' | The key of the RenderTexture in the Cache, if stored there.
  `scaleMode` | number | <optional> | Phaser.scaleModes.DEFAULT | One of the Phaser.scaleModes consts.

  Source:
    - gameobjects/RenderTexture.js, line 18

### Members

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running game.

  Source:
    - gameobjects/RenderTexture.js, line 26

#### key

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `key` | string | The key of the RenderTexture in the Cache, if stored there.

  Source:
    - gameobjects/RenderTexture.js, line 31

#### type

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `type` | number | Base Phaser object type.

  Source:
    - gameobjects/RenderTexture.js, line 36

### Methods

#### render(displayObject, position, clear)

  This function will draw the display object to the texture.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `displayObject` | Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapText | Phaser.Group | The display object to render to this texture.
  `position` | Phaser.Point | A Point object containing the position to render the display object at.
  `clear` | boolean | If true the texture will be cleared before the display object is drawn.

  Source:
    - gameobjects/RenderTexture.js, line 70

#### renderXY(displayObject, x, y, clear)

  This function will draw the display object to the texture.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `displayObject` | Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapText | Phaser.Group | The display object to render to this texture.
  `x` | number | The x position to render the object at.
  `y` | number | The y position to render the object at.
  `clear` | boolean | If true the texture will be cleared before the display object is drawn.

  Source:
    - gameobjects/RenderTexture.js, line 51

#### resize(width, height)

  Resize this RenderTexture to the given width and height.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `width` | number | The new width of the RenderTexture.
  `height` | number | The new height of the RenderTexture.

  Source:
    - gameobjects/RenderTexture.js, line 72