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

Re: [Public WebGL] Retrieving number of texture channels

On 24/02/2010 11:46, Kenneth Russell wrote:
> On Tue, Feb 23, 2010 at 5:59 PM, Mark Callow <callow_mark@hicorp.co.jp> wrote:
>> 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.
We have the same problem in M3G in cases when we are forced to use the
JVM to load PNG files. We found a way around it. It is ugly but
functional. We can access the raw byte array so we look at the header to
determine the number of channels and then convert the data back to the
original format. The L->RGB->L transform is well known. A->RGBA->A is
obviously not a problem.



fn:Mark Callow
org:HI Corporation;Graphics Lab, Research & Development
adr:Higashiyama 1-4-4, Meguro-ku;;Meguro Higashiyama Bldg 5F;Tokyo;;153-0043;Japan
title:Chief Architect
tel;work:+81 3 3710 9367 x228
tel;fax:+81 3 5773 8660
url:http://www.hicorp.co.jp,  http://www.mascotcapsule.com