[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions

On Sun, Apr 11, 2010 at 23:45, Cedric Vivier <cedricv@neonux.com> wrote:
function handleLoadedTexture(image, texture) {
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.texImage2D(gl.TEXTURE_2D, 0, image);

the data cannot be loaded in GL since ctx.bindTexture will generate an INVALID_OPERATION error as the WebGL object created in previously valid context is invalid.

Though above is correct when the belated asset (that should have been loaded in a previously valid context) fires onload event _before_ assets have been loaded in restored context, the result is undefined otherwise as it would result in overwriting a newly loaded and bound texture.

This implies that whatever model we end up with, to prevent nondeterministic errors after context restoration (e.g visible 'garbage' due to overwritten textures) the spec has to specify that an attempt to bind an invalidated WebGL object (texture, buffer, ...) generates an error AND unbinds any object currently bound to related target.