我正在使用 Twgl.js 库来使用 webgl2
我有一个如下所示的数组,我正在使用它制作缓冲区并与 VAO 一起createBufferInfoFromArrays
使用drawObjectList
来绘制它,但是在我更改我的数组以使用一些无符号字节值而不是浮点数之后,我遇到了哪个 chrome 导致此错误的问题
GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to draw with all attributes having non-zero divisors
更改前的数组:
EdgeArrays = {
pos:{
numComponents: 2,
data: [-1,.01, -1,-.01 , 1,.01 , 1,-.01]
},
center: {
numComponents: 2,
data: new Float32Array( Lines.CenterBuffer ),
divisor: 1,
},
size: {
numComponents: 2,
data: new Float32Array( Lines.SizeBuffer ),
divisor: 1,
},
rotate: {
numComponents: 4,
data: new Float32Array( Lines.RotateBuffer ),
divisor: 1,
},
appear: {
numComponents: 1,
data: new Float32Array( Lines.AppearBuffer ),
divisor: 1,
},
Active: {
numComponents: 1,
data: new Float32Array( Lines.ActiveBuffer ),
divisor: 1,
},
};
更改后的数组
let Arrays = {
Pos:{
numComponents: 2,
data: [-1,.01, -1,-.01 , 1,.01 , 1,-.01]
},
Center: {
numComponents: 2,
data: new Float32Array( Buffers.Center ),
divisor: 1,
},
Size: {
numComponents: 2,
data: new Float32Array( Buffers.Size ),
divisor: 1,
},
Rotate: {
numComponents: 4,
data: new Float32Array( Buffers.Rotate ),
divisor: 1,
},
Appear: {
numComponents: 1,
data: new Uint8Array( Buffers.Appear ),
type: gl.UNSIGNED_BYTE ,
normalize: false,
divisor: 1,
},
Active: {
numComponents: 1,
data: new Uint8Array( Buffers.Active ),
type: gl.UNSIGNED_BYTE ,
normalize: false,
divisor: 1,
},
InstInfo:{
numComponents: 2,
data: new Uint8Array( Buffers.InstInfo ),
type: gl.UNSIGNED_BYTE ,
normalize: false,
divisor: 1,
}
};
错误是说没有没有除数的缓冲区,但第一个(pos 缓冲区)没有除数!我错了什么?
提前致谢