View Full Version : image.onload - returns 1282 glError

07-26-2010, 11:40 PM
Hi All,
Im trying to load a texture with below function, but Im sometimes getting:
- in minefield glError (alert in the code) error 1282. Mostly when I refresh the page
- in chrome error 1281: Only when I go to my page from another page. If I refresh or if I open the same link which is already opened (the same page) I get 0.

In most cases Im getting 0, but why I get sometimes 1282 or 1281? I can think that the problem can be somewhere else, but it is difficult to find where.

function loadTexture(src) {
// Create and initialize the WebGLTexture object.
var DEMtexture = gl.createTexture();
DEMtexture.image = new Image();

DEMtexture.image.onload = function() {
gl.bindTexture(gl.TEXTURE_2D, DEMtexture);
gl.texImage2D(gl.TEXTURE_2D, 0, DEMtexture.image, true);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);

// Start downloading the image by setting its source.
DEMtexture.image.src = src;
// Return the WebGLTexture object
return DEMtexture;

07-26-2010, 11:58 PM
problem was in some other code :roll: