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

Re: [Public WebGL] Retrieving number of texture channels


The reason  glGetTexLevelParameter was dropped is that internal format
conversions were dropped. In GL ES, the format and internalformat
parameters of TexImage2D must match. Therefore the application knows the
format it specified.

The WebGL implementation must know what format it is specifying when
loading HTMLImages. Chris mentioned that they are loaded as either RGB
or RGBA format depending on presence of an alpha channel. So it doesn't
seem like it would be hard to add a query to WebGL. On the other hand,
since they are never loaded as 1 or 2 channel textures, the X3D
implementation doesn't need to know the difference. It can always use
the texture color as the diffuse color.

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.



On 23/02/2010 05:28, Chris Marrin wrote:
> On Feb 22, 2010, at 11:50 AM, Johannes Behr wrote:
>> Hi,
>>>> is there already a possibility to retrieve the number of present texture
>>>> channels (intensity, luminance-alpha, rgb or rgba texture) in WebGL?
>>>> ...
>>> Unfortunately OpenGL ES seems to have dropped the
>>> glGetTexLevelParameter query, which is needed to query the texture's
>>> internal format, so WebGL doesn't currently contain it.
>>> We could probably emulate this call in WebGL implementations on top of
>>> OpenGL ES by tracking the internal format used when the texture was
>>> uploaded. In the short term, doing so in your library would be your
>>> best workaround.
>> But how should we track it in x3dom? AFAIK is there now method
>> to ask a HTML image for some internal type or number of channels.
> I don't think we should blaze the trail here. It seems reasonable that, for now, the author has to know what types of images are being loaded. Of course, I bet clever programming could reveal the type somehow.

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