# WebGLBatch - Pixi.JS

#

API Docs for: 1.0.0
Show: Inherited Protected Private Deprecated

# WebGLBatch Class

Defined in: `src/pixi/renderers/WebGLRenderGroup.js:8`
Module: PIXI

A WebGLBatch Enables a group of sprites to be drawn using the same settings. if a group of sprites all have the same baseTexture and blendMode then they can be grouped into a batch. All the sprites in a batch can then be drawn in one go by the GPU which is hugely efficient. ALL sprites in the webGL renderer are added to a batch even if the batch only contains one sprite. Batching is handled automatically by the webGL renderer. A good tip is: the smaller the number of batchs there are, the faster the webGL renderer will run.

- Index
- Methods

## Item Index

### Methods

- init
- insertAfter
- insertBefore
- merge
- refresh
- remove
- render
- split
- update

## Methods

### `init`

(

- `sprite`

)

Defined in `src/pixi/renderers/WebGLBatch.js:98`

inits the batch's texture and blend mode based if the supplied sprite

#### Parameters:

- `sprite` Sprite

  the first sprite to be added to the batch. Only sprites with the same base texture and blend mode will be allowed to be added to this batch

### `insertAfter`

(

- `sprite`
- `previousSprite`

)

Defined in `src/pixi/renderers/WebGLBatch.js:145`

inserts a sprite after the specified sprite

#### Parameters:

- `sprite` Sprite

  the sprite to be added

- `previousSprite` Sprite

  the first sprite will be inserted after this sprite

### `insertBefore`

(

- `sprite`
- `nextSprite`

)

Defined in `src/pixi/renderers/WebGLBatch.js:117`

inserts a sprite before the specified sprite

#### Parameters:

- `sprite` Sprite

  the sprite to be added

- `nextSprite` NextSprite

  the first sprite will be inserted before this sprite

### `merge`

(

- `batch`

)

Defined in `src/pixi/renderers/WebGLBatch.js:267`

Merges two batchs together

#### Parameters:

- `batch` WebGLBatch

  the batch that will be merged

### `refresh`

()

Defined in `src/pixi/renderers/WebGLBatch.js:345`

Refresh's all the data in the batch and sync's it with the webGL buffers

### `remove`

(

- `sprite`

)

Defined in `src/pixi/renderers/WebGLBatch.js:175`

removes a sprite from the batch

#### Parameters:

- `sprite` Sprite

  the sprite to be removed

### `render`

()

Defined in `src/pixi/renderers/WebGLBatch.js:513`

Draws the batch to the frame buffer

### `split`

(

- `sprite`

)
WebGLBatch

Defined in `src/pixi/renderers/WebGLBatch.js:218`

Splits the batch into two with the specified sprite being the start of the new batch.

#### Parameters:

- `sprite` Sprite

  the sprite that indicates where the batch should be split

#### Returns:

WebGLBatch: the new batch

### `update`

()

Defined in `src/pixi/renderers/WebGLBatch.js:400`

Updates all the relevant geometry and uploads the data to the GPU