Ver Fonte

WebGLRenderer: gl.bufferSubData doesn't seem to work with gl.STATIC_DRAW.

Mr.doob há 10 anos atrás
pai
commit
46a5ec0115
1 ficheiros alterados com 9 adições e 1 exclusões
  1. 9 1
      src/renderers/WebGLRenderer.js

+ 9 - 1
src/renderers/WebGLRenderer.js

@@ -3939,7 +3939,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					if ( attribute.updateRange === undefined || attribute.updateRange.count === -1 ) { // Not using update ranges
 
-						_gl.bufferSubData( bufferType, 0, attribute.array );
+						if ( attribute instanceof THREE.DynamicBufferAttribute ) {
+
+							_gl.bufferSubData( bufferType, 0, attribute.array );
+
+						} else {
+
+							_gl.bufferData( bufferType, attribute.array, _gl.STATIC_DRAW );
+
+						}
 
 					} else if ( attribute.updateRange.count === 0 ) {