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 inWeb Workers.
TheWebGLRenderingContext.bindRenderbuffer() method oftheWebGL API binds a givenWebGLRenderbuffer to a target, which must begl.RENDERBUFFER.
In this article
Syntax
js
bindRenderbuffer(target, renderbuffer)Parameters
targetA
GLenumspecifying the binding point (target). Possible values:gl.RENDERBUFFERBuffer data storage for single images in arenderable internal format.
renderbufferA
WebGLRenderbufferobject to bind.
Return value
None (undefined).
Exceptions
Agl.INVALID_ENUM error is thrown iftarget is notgl.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 theRENDERBUFFER_BINDINGconstant.
js
gl.getParameter(gl.RENDERBUFFER_BINDING);Specifications
| Specification |
|---|
| WebGL Specification> # 5.14.7> |