Переглянути джерело

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;
 
 	};