[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Adding internalformat param to all texImage2d variants
On 18 May 2010, at 19:07, Chris Marrin wrote:
> On May 18, 2010, at 10:00 AM, Chris Marrin wrote:
>> On May 17, 2010, at 5:57 PM, Vladimir Vukicevic wrote:
>>> ----- "Kenneth Russell" <firstname.lastname@example.org> wrote:
>>> On Fri, May 14, 2010 at 4:06 PM, Chris Marrin <email@example.com> wrote:
>>>> I would feel comfortable doing that if the browser implementors agree that this is information we can get from the HTML image element.
>>> WebKit would currently always return RGBA as the internal format, or
>>> perhaps RGB if we could determine that the original image has no alpha
>>> channel. We might be able to improve the precision of this query over
>>> time. Does this sound acceptable and/or useful?
>>> We would do the same for now. Would be straightforward to improve in the future.
>> That doesn't solve the X3DOM problem today. Unless they add an internalformat property to ImageTexture, there would be no way to get a 1 or 2 channel image into the system.
>> FWIW, WebKit remembers whether or not an image has an alpha channel as an optimization. I haven't looked at the code, but I suspect it would not be hard to remember if the image has 1 or 2 channels as well. If we were to add getTexLevelParameter() to the spec as Ken suggests, we could return this information.
>> Here's how I think it would work. We would add an internalformat param to all texImage2D() forms that don't currently have it. We would also add getTexLevelParameter() and all the enums described here:
>> Some of the queried values would return default values, e.g., TEXTURE_DEPTH (always 1), TEXTURE_BORDER (always 0), etc.
>> If you pass one of the legal internalformat enums to texImage2D() it will convert the source image into that format. In that case getTexLevelParameter would always return that value for gl.TEXTURE_INTERNAL_FORMAT. You can also pass NONE which would convert the image to the "original" format, according to the table:
>> 1 channel: LUMINANCE
>> 2 channel: LUMINANCE_ALPHA
>> 3 channel: RGB
>> 4 channel: RGBA
>> Note that there is no way to create an ALPHA texture from a 1 channel image. This is a problem in X3D as well. There is no way I know of to create an ImageTexture that is alpha-only. I don't think this is a problem. You'd just have to know the image you're loading is 1 channel and then set internalformat to ALPHA.
>> The form of texImage2D which takes an ArrayBufferView would not all NONE as an internalformat and would generate a GL error.
>> How does all that sound?
> In thinking about this some more, I agree with Cedric and Gregg that returning the actual format is not really necessary. If we're able to support gl.NONE (or some custom enum as Mark suggests) as an internalformat and it loads the image in the original source format, I think that satisfies the requirements of X3DOM. So I think we should eliminate getTexLevelParameter() and just add internalformat to texImage2D() and add an enum which allows us to add the image in the original format.
The difference is, that we can not query anymore but must give the "internalFormat" with every texture. Correct ?
> You are currently subscribe to firstname.lastname@example.org.
> To unsubscribe, send an email to email@example.com with
> the following command in the body of your email:
Dr. Johannes Behr
Leiter Projektbereich VR
Fraunhofer-Institut für Graphische Datenverarbeitung IGD
Fraunhoferstr. 5 | 64283 Darmstadt | Germany
Tel +49 6151 155-510 | Fax +49 6151 155-196
firstname.lastname@example.org | www.igd.fraunhofer.de
You are currently subscribe to email@example.com.
To unsubscribe, send an email to firstname.lastname@example.org with
the following command in the body of your email: