WebGL GL ERROR: GL_INVALID_OPERATION: glDrawElements: intento de acceso a vértices fuera de rango en el atributo 1

Estoy intentando corregir un error preexistente en algún código que se basa en TRES. Rev. 49 con algunos sombreadores personalizados.

Soy un total de WebGL, por lo que no he podido hacer muchas respuestas ni respuestas, ya que parecían asumir muchos más conocimientos de los que yo tenía. ¡Estaría muy agradecido de cualquier indicio sobre qué buscar! :) El resultado final del código es dibujar una estructura de alambre de caja translúcida y pintar las caras con texturas translúcidas.

El error particular es:

[.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1

He rastreado el tema a un particular_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 ); en THREE.WebGLRenderer.renderBuffer.

Aquí hay un fragmento del código de llamada:

scene.overrideMaterial = depthMaterial; // shaders below
var ctx = renderer.getContext(); // renderer is a THREE.WebGLRenderer
ctx.disable(ctx.BLEND);
// renderTarget is a THREE.WebGLRenderTarget, _camera, scene is obvious
renderer.render(scene, _camera, renderTarget, true); // error occurs here

Aquí están los sombreadores relevantes:

    uniforms: {},

    vertexShader: [
        "varying vec3 vNormal;",

        "void main() {",

            "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
            "vNormal = normalMatrix * normal;",

            "gl_Position = projectionMatrix * mvPosition;",

        "}"
    ].join("\n"),

    fragmentShader: [
        "vec4 pack_depth( const in highp float depth ) {",

            "const highp vec4 bit_shift = vec4( 256.0, 256.0*256.0, 256.0*256.0*256.0, 256.0*256.0*256.0*256.0 );",
            "vec4 res = depth * bit_shift;",
            "res.x = min(res.x + 1.0, 255.0);",
            "res = fract(floor(res) / 256.0);",
            "return res;",

        "}",

        "void main() {",
            "gl_FragData[0] = pack_depth( gl_FragCoord.z );",
        "}"
    ].join("\n")

¡Gracias por tu ayuda!

Respuestas a la pregunta(2)

Su respuesta a la pregunta