Expand Minimize

bufferData method

Creates a buffer in memory and initializes it with array data. If no array is provided, the contents of the buffer is initialized to 0.

IE11

Syntax

WebGLRenderingContext.bufferData(target, size or data, usage);

Parameters

target [in]

Type: Number

Set to gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER.

size or data [in]

Type: number or ArrayBuffer

An array of data points, or the size of the buffer to initialize.

usage [in]

Type: Number

One of the following values:

  • gl.STATIC_DRAW The data store contents are modified once, and used many times as the source for WebGL drawing commands.
  • gl.DYNAMIC_DRAW The data store contents are repeatedly respecified, and used many times as the source for WebGL drawing commands.
  • gl.STREAM_DRAW The data store contents are specified once, and used occasionally as the source of a WebGL drawing command.

Usage is provided only as a performance hint. The usage value doesn't restrict the way the data store is used.

Return value

This method does not return a value.

Remarks

WebGL errorDescription
gl.OUT_OF_MEMORYIf WebGL can't create the buffer to the requested size.

 

BufferData deletes any existing data store and sets the state variables gl.BUFFER_SIZE and gl.BUFFER_USAGE to the new values.

See also

WebGLRenderingContext

 

 

Show:
© 2014 Microsoft