WebGL Objects, Targets and Bindings

GL objects

Objectremarks
Buffer
Texture
RenderBuffer
Sampler*
Query*
VertexArray*container
Framebuffercontainer
TransformFeedback*container

*new in WebGL 2

  • create<object>(): e.g. createBuffer(), createTexture(), etc
  • bind<object>(); unbind by binding to null
  • delete<object>()

Each object may have multple targets. Targets determine what you can do with an object, its specific behaviors. E.g. binding a buffer to gl.ELEMENT_ARRAY_BUFFER enables gl.drawElements().

WebGL functions may depend on objects bound to targets. Binding connects an object with a set of functions.

Functions can be target-free, e.g. gl.drawArrays.

A very incomplete list of dependencies:

ARRAY
_BUFFER
COPY
_READ
_BUFFER
COPY
_WRITE
_BUFFER
ELEMENT
_ARRAY
_BUFFER
PIXEL
_PACK
_BUFFER
PIXEL
_UNPACK
_BUFFER
bindBuffer++++++
bufferData++++++
bufferSubData++++++
copyBufferSubData++++++
getBufferParameter++++++
vertexAttribPointer+
drawElements+
drawElementsInstanced+
drawRangeElements+
readPixels+
compressedTexImage2D+

and so on, and so on.