Skip to content

Commit eaaf205

Browse files
committed
DataTexture: Set unpackAlignment to 1 by default. See mrdoob#9566.
1 parent a70b90b commit eaaf205

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/renderers/webgl/WebGLTextures.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @author mrdoob / http://mrdoob.com/
33
*/
44

5-
import { LinearFilter, NearestFilter, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, FloatType, HalfFloatType, UnsignedByteType, ClampToEdgeWrapping, NearestMipMapLinearFilter, NearestMipMapNearestFilter } from '../../constants';
5+
import { LinearFilter, NearestFilter, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, FloatType, HalfFloatType, ClampToEdgeWrapping, NearestMipMapLinearFilter, NearestMipMapNearestFilter } from '../../constants';
66
import { _Math } from '../../math/Math';
77

88
function WebGLTextures( _gl, extensions, state, properties, capabilities, paramThreeToGL, info ) {
@@ -410,17 +410,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
410410

411411
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
412412
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
413-
414-
if ( texture.isDataTexture && texture.unpackAlignment !== 1 &&
415-
_Math.isPowerOfTwo( texture.image.width ) === false &&
416-
texture.format === RGBFormat &&
417-
texture.type === UnsignedByteType ) {
418-
419-
console.warn( 'THREE.WebGLRenderer: Changed unpackAlignment to 1. See #9566.', texture );
420-
texture.unpackAlignment = 1;
421-
422-
}
423-
424413
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
425414

426415
var image = clampToMaxSize( texture.image, capabilities.maxTextureSize );

src/textures/DataTexture.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT,
1616

1717
this.flipY = false;
1818
this.generateMipmaps = false;
19+
this.unpackAlignment = 1;
1920

2021
}
2122

0 commit comments

Comments
 (0)