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

Re: [Public WebGL] readPixels and out of range pixels



On Sun, Feb 7, 2010 at 10:12 AM, Oliver Hunt <oliver@apple.com> wrote:
>
> On Feb 7, 2010, at 5:23 AM, Gregg Tavares wrote:
>
>> I noticed the current spec doesn't appear to mention how out of range pixels are handled by calls to readPixels.
>>
>> The OpenGL ES 2.0 spec makes them undefined, meaning you can have a back buffer that is 10x10 but call glReadPixels with 100x100 and you'll get back something.
>>
>> That doesn't seem like it should go undefined in WebGL.
>>
>> Two solutions off the top of my head.
>>
>> 1) leave it the way it is but specified that out of range pixels are 0,0,0,0
>>
>> 2) return INVALID_OPERATION if any out of range pixels are requested.
>>
>> I think I'd prefer #2 because it makes it obvious when you are asking for something that is not part of the current framebuffer unless there is some other reason to go with #1.
>
> I prefer #1 as it's consistent with the canvas2d getImageData API

I slightly prefer #2 because it will avoid a cleanup pass over the
returned data, but don't have a strong preference. It may be better to
go for consistency. If we specify that out-of-range pixels have 0 as
their value then the cleanup code won't be that complicated.

-Ken
-----------------------------------------------------------
You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: