|
@@ -61,6 +61,30 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
|
|
|
var currentScissor = new THREE.Vector4();
|
|
|
var currentViewport = new THREE.Vector4();
|
|
|
|
|
|
+ function createTexture( type, target, count ) {
|
|
|
+
|
|
|
+ var data = new Uint8Array( 3 );
|
|
|
+ var texture = gl.createTexture();
|
|
|
+
|
|
|
+ gl.bindTexture( type, texture );
|
|
|
+ gl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.LINEAR );
|
|
|
+
|
|
|
+ for ( var i = 0; i < count; i ++ ) {
|
|
|
+
|
|
|
+ gl.texImage2D( target + i, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, data );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return texture;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var emptyTextures = {};
|
|
|
+ emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
|
|
|
+ emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
this.init = function () {
|
|
|
|
|
|
this.clearColor( 0, 0, 0, 1 );
|
|
@@ -622,7 +646,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
|
|
|
|
|
|
if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {
|
|
|
|
|
|
- gl.bindTexture( webglType, webglTexture );
|
|
|
+ gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );
|
|
|
|
|
|
boundTexture.type = webglType;
|
|
|
boundTexture.texture = webglTexture;
|