I'm assuming you know the size of a pixel. for gl.RGBA, gl_UNSIGNED_BYTE it
would be 4
The default unpackAlignment is 4
On Fri, Sep 7, 2012 at 12:55 AM, Tomáš Sychra <xsych
...@gmail.com> wrote:
> Hi,
> can somebody help me please with this error : WebGL: INVALID_OPERATION:
> texImage2D: ArrayBufferView not big enough for request ?
> I don´t understand to that, because ArrayBuffer, that i want to paint isnt
> big enaught (another one - more bigger - i can paint with any problems)..so
> where could be problem?
> Help me please...
> code where the error is :
> i called this :
> textures.textureYZ.refreshTextureData(gl, texGen.generateYZTexture(),
> cube3D.width, cube3D.numCuts, gl.RGBA);
> refreshTexture method :
> /**
> * Actualize texture
> */
> function refreshTextureData(gl, dataArray, width, height, type) {
> gl.bindTexture(gl.TEXTURE_2D, texture);
> // ----> HERE IS THE PROBLEM
> gl.texImage2D(gl.TEXTURE_2D, 0, type, width, height, 0, type,
> gl.UNSIGNED_BYTE, dataArray);
> //solution of Power of 2 only textures - we didnt REPEAT
> gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
> gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
> gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
> gl.bindTexture(gl.TEXTURE_2D, null);
> }