DataTexture doesn’t support NPOT textures

Description of the problem

Creating a texture with DataTexture of 227×227 RGB pixels results in a ” texImage2D: ArrayBufferView not big enough for request” error.

Excerpt from my code:

var values = new Uint8Array(…);
var texture = new THREE.DataTexture(values, 227, 227, THREE.RGBFormat, THREE.UnsignedByteType);

(I double-checked values.length, it’s 227x227x3=154587 as it should be).

Or using ImageUtils, which results in the same error:

var texture = THREE.ImageUtils.generateDataTexture(227, 227, new THREE.Color(0xffffff));

NPOT texture WebGL support is definitely working, as simply loading a 227×227 image from a static PNG using the TextureLoader renders correctly.

Three.js version



Tested with Chrome 52.0.2743.116


Arch Linux 64-bit

Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “DataTexture doesn’t support NPOT textures

Comments are closed.