WebGLRenderingContext's texImage2D and texSubImage2D function
<p>I have a one question about WebGLRenderingContext's texImage2D and texSubImage2D function. 
What I trying to create is something similar like loading image by tile by tile.   </p>

<p>Here is my first function. It's working properly while it's first load. But whenever loading second time using same function but tiled background.
It failed. Look at the code below</p>

<p>// This is first load code which is working fine</p>

<pre><code>gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null)

gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, image)
</code></pre>

<p>// This is second time using same but one different coding section [image data from canvas]. But it's not working. </p>

<pre><code>gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, [image data from canvas])

gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, image)
</code></pre>

<p>Have you ever face the problem similar like me. Then please guide me to the light. Much appreciate it.</p>

<p><strong>UPD</strong></p>

<pre><code>on('start', function (data) {

      gl.bindTexture(gl.TEXTURE_2D, handle)
      // gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, data.width, data.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, myCanvasData)
      gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, data.width, data.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(myCanvasData.buffer))

    }).on('progress', function (ev) {
      var x = ev.position[0]
      var y = texHeight - ev.position[1] - ev.image.height

      // now blit the intermediate image
      gl.bindTexture(gl.TEXTURE_2D, handle)
      gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, ev.image)

    }).on('complete', function () {
    })
</code></pre>

<p><a href="http://i.stack.imgur.com/tp9J7.png" rel="nofollow" title="tooltip">Console warning image</a></p>