Bladeren bron

createVertexArray tweaks

Alexander Rose 6 jaren geleden
bovenliggende
commit
64d6e185fe
1 gewijzigde bestanden met toevoegingen van 6 en 5 verwijderingen
  1. 6 5
      src/mol-gl/webgl/vertex-array.ts

+ 6 - 5
src/mol-gl/webgl/vertex-array.ts

@@ -13,11 +13,12 @@ export function createVertexArray(ctx: WebGLContext, program: Program, attribute
     let vertexArray: WebGLVertexArrayObject | null = null
     if (vertexArrayObject) {
         vertexArray = vertexArrayObject.createVertexArray()
-        vertexArrayObject.bindVertexArray(vertexArray)
-        if (elementsBuffer) elementsBuffer.bind()
-        program.bindAttributes(attributeBuffers)
-        ctx.stats.vaoCount += 1
-        vertexArrayObject.bindVertexArray(null)
+        if (vertexArray) {
+            updateVertexArray(ctx, vertexArray, program, attributeBuffers, elementsBuffer)
+            ctx.stats.vaoCount += 1
+        } else {
+            console.warn('Could not create WebGL vertex array')
+        }
     }
     return vertexArray
 }