Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在WebGL(2)中是否不允许将gl.ARRAY\u BUFFER和顶点属性数组绑定到0_Webgl_Webgl2 - Fatal编程技术网

在WebGL(2)中是否不允许将gl.ARRAY\u BUFFER和顶点属性数组绑定到0

在WebGL(2)中是否不允许将gl.ARRAY\u BUFFER和顶点属性数组绑定到0,webgl,webgl2,Webgl,Webgl2,在openGL中,通常通过调用(OGL等价于)来“解除绑定”数组\ U缓冲区和任何绑定VAO: 但是,当我在WebGL(2)中执行此操作时,会出现以下错误: Uncaught TypeError: Failed to execute 'bindBuffer' on 'WebGL2RenderingContext': parameter 2 is not of type 'WebGLBuffer'. 我们不应该在WebGL(2)中这样做吗?您必须传入null而不是0 gl.bindBuffer(

在openGL中,通常通过调用(OGL等价于)来“解除绑定”数组\ U缓冲区和任何绑定VAO:

但是,当我在WebGL(2)中执行此操作时,会出现以下错误:

Uncaught TypeError: Failed to execute 'bindBuffer' on 'WebGL2RenderingContext': parameter 2 is not of type 'WebGLBuffer'.

我们不应该在WebGL(2)中这样做吗?

您必须传入
null
而不是0

gl.bindBuffer(gl.ARRAY_BUFFER, null)
gl.bindVertexArray(null)

由于各种原因,WebGL不像OpenGL那样使用
GLint
ID,它使用对象
WebGLBuffer
WebGLTexture
WebGLVertexArrayObject
,等等。。。并且0版本是
null

您必须传入
null
而不是0

gl.bindBuffer(gl.ARRAY_BUFFER, null)
gl.bindVertexArray(null)
由于各种原因,WebGL不像OpenGL那样使用
GLint
ID,它使用对象
WebGLBuffer
WebGLTexture
WebGLVertexArrayObject
,等等。。。0版本为
null