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

Re: [Public WebGL] Retrieving number of texture channels



On Tue, Feb 23, 2010 at 5:59 PM, Mark Callow <callow_mark@hicorp.co.jp> wrote:
> Hi Chris,
>
> On 24/02/2010 07:25, Chris Marrin wrote:
>> On Feb 22, 2010, at 6:21 PM, Mark Callow wrote:
>>
>>
>>> ...
>>> I agree with Ken that adding support to WebGL for deciphering HTMLImages
>>> that are PNG files to automatically determine the format to use for
>>> TexImage2D is an enhancement. A query will clearly need to be part of
>>> this enhancement.
>>>
>>
>> We don't need queries for this. We simply need to know what the resultant internal format is for each type of image loaded. As I mentioned in other responses, adding a format param would provide this.
>>
>
> "Query will clearly (be) need(ed)" was predicated on "automatically
> determine the format". If you add a format specifier to the TexImage2D
> that accepts an HTMLImage then I completely agree a query is not needed.
> We had the same problem vis-a-vis one-channel luminance vs. alpha when
> loading PNG files in M3G. We added a format parameter there too.
>
> When writing the spec. for this format parameter bear in mind that OGL
> ES does not support internal format conversions. Therefore perhaps you
> should throw an exception if, e.g. the app. tries to load a one-channel
> PNG image as RGB. In other words require that the specified format match
> the HTMLImage contents.

It will be difficult to enforce this requirement in the current
WebKit. The knowledge of the number of channels in the original image
is lost during image decoding (AFAIK). It would be simpler to define
rules for how images of varying numbers of channels are converted (on
the CPU) before uploading via OpenGL / OpenGL ES / D3D / etc.

I suspect that the X3D folks will not be completely happy with this
solution because they really want to figure out what the number of
channels was in the source image, not force it into a particular
format. Yvonne, Johannes, any comment?

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