Browse Source

Added onCreateCallback for WebGLAttributes #11883

Luis Blanco 7 years ago
parent
commit
152c85f1bd
1 changed files with 13 additions and 3 deletions
  1. 13 3
      src/renderers/webgl/WebGLAttributes.js

+ 13 - 3
src/renderers/webgl/WebGLAttributes.js

@@ -11,10 +11,20 @@ function WebGLAttributes( gl ) {
 		var array = attribute.array;
 		var usage = attribute.dynamic ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW;
 
-		var buffer = gl.createBuffer();
+		var buffer;
 
-		gl.bindBuffer( bufferType, buffer );
-		gl.bufferData( bufferType, array, usage );
+		if (attribute.onCreateCallback) {
+
+			buffer = attribute.onCreateCallback();
+
+		} else {
+
+			buffer = gl.createBuffer();
+
+			gl.bindBuffer( bufferType, buffer );
+			gl.bufferData( bufferType, array, usage );
+
+		}
 
 		attribute.onUploadCallback();