WebGLRenderingContext: bindRenderbuffer() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The WebGLRenderingContext.bindRenderbuffer() method of the WebGL API binds a given WebGLRenderbuffer to a target, which must be gl.RENDERBUFFER.
Syntax
js
bindRenderbuffer(target, renderbuffer) Parameters
target-
A
GLenumspecifying the binding point (target). Possible values:gl.RENDERBUFFER-
Buffer data storage for single images in a renderable internal format.
renderbuffer-
A
WebGLRenderbufferobject to bind.
Return value
None (undefined).
Exceptions
A gl.INVALID_ENUM error is thrown if target is not gl.RENDERBUFFER.
Examples
>Binding a renderbuffer
js
const canvas = document.getElementById("canvas"); const gl = canvas.getContext("webgl"); const renderbuffer = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); Getting current bindings
To check the current renderbuffer binding, query the RENDERBUFFER_BINDING constant.
js
gl.getParameter(gl.RENDERBUFFER_BINDING); Specifications
| Specification |
|---|
| WebGL Specification> # 5.14.7> |