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

Re: [Public WebGL] Adding internalformat param to all texImage2d variants



On May 19, 2010, at 10:36 AM, Gregg Tavares wrote:

> 
> 
> ...I'm not sure how it's any more alien than flipy and premultipliedAlpha. We might as well argue that naming these functions texImage2D is inappropriate. Perhaps it would be better to have conversion functions that take in one of the image element types and the convertTo, flipy and premultipliedAlpha params and return a filled in ArrayBuffer. I don't particularly like that idea because it would not allow optimizations that might be possible on some platforms, such as directly writing the image to GPU memory using some non-OpenGL mechanism.
> 
> Personally I think this is the better solution.
> 
> We're trying to add all kinds of conversion stuff to texImage2D that may or may not make sense.
> 
> How do the types UNSIGNED_SHORT_5_6_5, UNSIGNED_SHORT_4_4_4_4 and UNSIGNED_SHORT_5_5_5_1 fit into these conversions? For example one of the arguments for supporting conversion to LUMINANCE and ALPHA formats was space savings but if that's the argument for supporting conversions then it applies to these types as well.

> It really seems all this conversion belongs outside of texImage2D.  add ArrayBuffer ctx.convertTo(img, format, ....) or something like that.

First, let me note that these formats are not supported in the OpeGL ES 2.0, nor will they be supported in WebGL 1.0. But supporting these formats in the future seems like a perfect reason to keep the conversion in texImage2D. Requiring the data to be placed in a ArrayBuffer takes away the opportunity to optimize the conversions to these formats. What if your graphics hardware had the ability to convert RGB888 to RGB565? If you had to put the result in an ArrayBuffer on the CPU, you couldn't use that hardware, or at best you would have to do a slow GPU to CPU copy.

-----
~Chris
cmarrin@apple.com





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