RenderBuffer

Render Buffer can be attached to RenderTarget.

Constructor

new RenderBuffer(width, height, formatopt, multipleSamplingopt)

Parameters:
NameTypeAttributesDefaultDescription
widthnumber

The width of the render buffer.

heightnumber

The height of the render buffer.

formatPIXEL_FORMAT<optional>
PIXEL_FORMAT.RGBA8

The internal format of the render buffer.

multipleSamplingnumber<optional>
0

If bigger than zero, this renderBuffer will support multipleSampling. (Only usable in WebGL 2.0)

Extends

Members

format :PIXEL_FORMAT

Render buffer texel storage data format. DEPTH_COMPONENT16: for depth attachments. DEPTH_STENCIL: for depth stencil attachments. RGBA8:for multiple sampled color attachments. DEPTH_COMPONENT16: for multiple sampled depth attachments. DEPTH24_STENCIL8: for multiple sampled depth stencil attachments.

Default Value
  • PIXEL_FORMAT.RGBA8

height :number

The height of the render buffer.

Type:
  • number

(readonly) isRenderBuffer :boolean

Type:
  • boolean
Default Value
  • true

multipleSampling :number

If bigger than zero, this renderBuffer will support multipleSampling. (Only usable in WebGL 2.0) A Render Target's attachments must have the same multipleSampling value. Texture can't be attached to the same render target with a multiple sampled render buffer. Max support 8.

Type:
  • number
Default Value
  • 0

width :number

The width of the render buffer.

Type:
  • number

Methods

addEventListener(type, listener)

Adds a listener to an event type.

Parameters:
NameTypeDescription
typestring

The type of event to listen to.

listenerfunction

The function that gets called when the event is fired.

clone() → {RenderBuffer}

Returns a clone of this render buffer.

Returns:
Type: 
RenderBuffer

copy(source) → {RenderBuffer}

Copy the given render buffer into this render buffer.

Parameters:
NameTypeDescription
sourceRenderBuffer

The render buffer to be copied.

Returns:
Type: 
RenderBuffer

dispatchEvent(event)

Fire an event.

Parameters:
NameTypeDescription
eventobject

The event that gets fired.

dispose()

Dispatches a dispose event.

removeEventListener(type, listener)

Removes a listener from an event type.

Parameters:
NameTypeDescription
typestring

The type of the listener that gets removed.

listenerfunction

The listener function that gets removed.

resize(width, height) → {boolean}

Resize the render buffer.

Parameters:
NameTypeDescription
widthnumber

The width of the render buffer.

heightnumber

The height of the render buffer.

Returns:
  • If size changed.
Type: 
boolean