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

Re: [Public WebGL] Retrieving number of texture channels

On Feb 22, 2010, at 12:45 PM, Johannes Behr wrote:

> On 22 Feb 2010, at 21: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?
>>>>> Because according to the X3D lighting model a material's diffuse color
>>>>> modulates the color of the texture in case of a one or two channel texture,
>>>>> which we need to know for implementing this correctly in X3DOM. If instead
>>>>> the texture has three or four channels (the typical case), the color of the
>>>>> texture is used as the diffuse color.
>>>>> You can find an example demonstrating this issue here:
>>>>> http://x3dom.org/x3dom/example/x3dom_imageChannels.xhtml
>>>> 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.
> But how? Should we add a new extra field to the ImageTexture-Node for the image type?
> This would be ignored by all content pipelines and would leave x3dom incompatible to all other x3d implementation.

Maybe I'm not sure what the issue is. If I load an HTML Image that is 1 component and then load that using texImage2D, will I have loaded a 1 channel texture? If so, then the author will use it as such. They will know it is a 1 component texture because they loaded it. I don't think the inability to query how many channels the texture has is a showstopper problem. 

Or is there another issue I'm not seeing (always a possibility)?


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: