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

Re: [Public WebGL] Adding internalformat param to all texImage2d variants



On May 12, 2010, at 4:12 PM, Kenneth Russell wrote:

> On Wed, May 12, 2010 at 11:55 AM, Cedric Vivier <cedricv@neonux.com> wrote:
>> On Thu, May 13, 2010 at 02:08, Chris Marrin <cmarrin@apple.com> wrote:
>>> I believe that covers all the cases. This assumes that all incoming grayscale images are converted to RGB and alpha is only present if it was in the original source image (which is never for JPG). I think this is the only way we can reasonably support the 1 and 2 channel formats for incoming images.
>>> 
>>> Comments?
>> 
>> 
>> I think all cases are handled... except the current case.
>> When a developer does not care - or even know [1] - about the format
>> for the given element, the helper should not perform undesirable
>> conversion, including in the case of incoming grayscale image.
>> This means we probably need to define eg. internalFormat=0 :
>> 
>> internalformat/incoming data                    RGB
>>       RGBA
>> ------------------------------------        ------
>>   --------
>> 0                                                          no
>> conversion                no conversion
> 
> Agreed, for convenience it should be possible to pass 0 for the internal format.
> 
> To be clear, is this the proposed new IDL?
> 
>    void texImage2D(GLenum target, GLint level, GLint internalformat,
> ImageData pixels, optional GLboolean flipY, optional GLboolean
> asPremultipliedAlpha) raises(DOMException);
>    void texImage2D(GLenum target, GLint level, GLint internalformat,
> HTMLImageElement image, optional GLboolean flipY, optional GLboolean
> asPremultipliedAlpha) raises(DOMException);
>    void texImage2D(GLenum target, GLint level, GLint internalformat,
> HTMLCanvasElement canvas, optional GLboolean flipY, optional GLboolean
> asPremultipliedAlpha) raises(DOMException);
>    void texImage2D(GLenum target, GLint level, GLint internalformat,
> HTMLVideoElement video, optional GLboolean flipY, optional GLboolean
> asPremultipliedAlpha) raises(DOMException);

It could be that, or we could make internalformat an optional param (shuffling the param order as needed). In either case, we should have a default internalformat, but it should not be 0. We should have a constant for it.

-----------------------------------------------------------
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: