Explorar o código

SpritePlugin: Fixed default texture.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
4b1e4db29e
Modificáronse 1 ficheiros con 11 adicións e 2 borrados
  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;
 
 	};