[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions
- To: Gregg Tavares <firstname.lastname@example.org>
- Subject: Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions
- From: Cedric Vivier <email@example.com>
- Date: Wed, 7 Apr 2010 00:07:35 +0800
- Cc: Chris Marrin <firstname.lastname@example.org>, public webgl <email@example.com>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:received:message-id :subject:to:cc:content-type; bh=0MudZ0x/JEjkDAjZFmSmtq5iAtFy40VWz6EfhfjDKdo=; b=kscTVaQdNOh6XIEvmVFi3+X44cYxX8OBQ+V/s3wDef75OeN6mhtkDbTtnhydudDm7r e6YPUWp9QMIFRXQ6VPI3SrheKQaoKtDVYVj/o7eoumaa2F6UZ/kIKgOyO4yTrzoF/wrr 9TV2nGzxvRPWtnU1RSYJ2A9Y9vhJq9UT1mYHg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=OGfMRMgmGjaXUr+IHLhL955kFh8T3u57OQL99jqNILh/6Wfo3SVz65VdaWQwcm9QqZ Uj6YL2BFyJQwkaeWN8E7hyWn56fFYlG7QwMYKgB/1yTpUZq4pawLczUiXCwYIv9Rimxl B/YGrYCtWbV4EpGRtWyNc6m6n+YplxG+XQZ8w=
- In-reply-to: <firstname.lastname@example.org>
- References: <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <B0664DAF-36DC-4CD9-BC11-A28F093B1E12@apple.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com>
- Sender: firstname.lastname@example.org
On Tue, Apr 6, 2010 at 23:42, Gregg Tavares <email@example.com>
On Tue, Apr 6, 2010 at 7:03 PM, Cedric Vivier <firstname.lastname@example.org>
The WebGLContextLostEvent and WebGLContextRestored event may be single
threaded but GL itself is not. The user can press the hibernate button at
any time. If the model is WebGL restores its self which is what
WebGLContextRestored suggests that this is a real case. I can keep trying to come up with examples where the context going from bad to good without app control is bad idea.
Afaik *if that's possible* (?) then WebGLContextRestored would have no drawbacks but only advantages (simplicity in both concept and user code implementation) compared with a WebGLContextReady+resetContext() right? (since the order of execution would be obligatory the same in both cases)
The problem with a zero length array is it has to be programmed for and it doesn't match OpenGL. In OpenGL I'd do this
static const char buffer[8*8*3];
glReadPixels(0, 0, 8, 8, GL_RGB, GL_UNSIGNED_BYTE, buffer);
// do something with 8x8 RGB pixels.
printf ("the red value of pixel at 7x7 is %d\n", buffer[(7*8+7)*3]);
Most programs don't care if there was an error. The buffer will be zero or the contents of the last successful glReadPixels.
In WebGL the same should be true.
var buf = ctx.readPixels(0, 0, 8, 8, GL_RGB, GL_UNSIGNED_BYTE);
document.write("the read value of pixel at 7x7 is " + buffer[(7*8+7)*3]);
It seems to me, in the spirit of GL that should not throw because (7*8+7)*3 is out of range nor should it return undefined.
True, actually WebGL spec currently does not rule out returning 0 here... the spec says an implementation can do any of these, that should be clarified maybe?