瀏覽代碼

SpritePlugin: Fixed default texture.

Mr.doob 11 年之前
父節點
當前提交
4b1e4db29e
共有 1 個文件被更改,包括 11 次插入2 次删除
  1. 11 2
      src/extras/renderers/plugins/SpritePlugin.js

+ 11 - 2
src/extras/renderers/plugins/SpritePlugin.js

@@ -65,8 +65,17 @@ THREE.SpritePlugin = function () {
 
 			alphaTest:			_gl.getUniformLocation( program, 'alphaTest' )
 		};
-
-		_texture = new THREE.Texture();
+		
+		var canvas = document.createElement( 'canvas' );
+		canvas.width = 8;
+		canvas.height = 8;
+		
+		var context = canvas.getContext( '2d' );
+		context.fillStyle = 'white';
+		context.fillRect( 0, 0, 8, 8 );
+
+		_texture = new THREE.Texture( canvas );
+		_texture.needsUpdate = true;
 
 	};