WebGLRenderingContext.isBuffer()

WebGLRenderingContext.isBuffer() 是 WebGL API 的方法之一。如果传递的 WebGLBuffer 有效则返回 true,否则返回 false。

句法

GLboolean gl.isBuffer(buffer);

参数

buffer (缓冲区)
需要检查的 WebGLBuffer

返回值

GLboolean (en-US) 指示 buffer 是否可用。

示例

创建一个缓冲区 (buffer)

var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");
var buffer = gl.createBuffer();

gl.isBuffer(buffer);

规范

Specification Status Comment
WebGL 1.0
isBuffer
Recommendation Initial definition.
OpenGL ES 2.0
glIsBuffer
Standard Man page of the OpenGL API.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 9 12 4.0 (2.0) 11 12 5.1
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support ? 25 (Yes) 4.0 (2.0) 1.0 ? 12 8.0

另见