Skip to content

Commit 59a43f7

Browse files
dphilmrdoob
authored andcommitted
change pixel size of new texture to 4 bytes to match default unpack alignment value (mrdoob#9107)
1 parent 338ca0e commit 59a43f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/renderers/webgl/WebGLState.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
5050

5151
function createTexture( type, target, count ) {
5252

53-
var data = new Uint8Array( 3 );
53+
var data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.
5454
var texture = gl.createTexture();
5555

5656
gl.bindTexture( type, texture );
@@ -59,7 +59,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
5959

6060
for ( var i = 0; i < count; i ++ ) {
6161

62-
gl.texImage2D( target + i, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, data );
62+
gl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
6363

6464
}
6565

0 commit comments

Comments
 (0)