瀏覽代碼

WebGLRenderer: Giving ‘position’ attribute index 0 by default. Fixes #4364.

Mr.doob 11 年之前
父節點
當前提交
b7950e02a3
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      src/renderers/WebGLRenderer.js

+ 9 - 3
src/renderers/WebGLRenderer.js

@@ -5700,11 +5700,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.attachShader( program, glVertexShader );
 		_gl.attachShader( program, glFragmentShader );
 
-		//Force a particular attribute to index 0.
+		// Force a particular attribute to index 0.
 		// because potentially expensive emulation is done by browser if attribute 0 is disabled.
-		//And, color, for example is often automatically bound to index 0 so disabling it
-		if ( index0AttributeName ) {
+		// And, color, for example is often automatically bound to index 0 so disabling it
+		if ( index0AttributeName !== undefined ) {
+
 			_gl.bindAttribLocation( program, 0, index0AttributeName );
+
+		} else {
+
+			_gl.bindAttribLocation( program, 0, 'position' );			
+
 		}
 
 		_gl.linkProgram( program );