Error using Uint8Array index in WebGLBufferGeometry

I am getting a GL ERROR :GL_INVALID_OPERATION : glDrawElements: range out of bounds for buffer when my BufferGeometrys index attribute is a Uint8Array. It does however work with Uint16Array.

I created this jsfiddle which demonstrates the problem. Go down to the line noted and change the type from Uint16Array to Uint8Array to see the issue.

#8358 seems similar but was resolved.

The offending code looks to be these lines in WebGLIndexedBufferRenderer such that when it encounters Uint8Array it does not set the size to 1 but 2 instead. It seems as though THREE.js just doesn’t support it. Is it intentional or is there some other reason?

Tested

  • r82 and r83dev
  • Chrome and Firefox
  • Windows
  • Intel Integrated Graphics

Author: Fantashit

1 thought on “Error using Uint8Array index in WebGLBufferGeometry

Comments are closed.