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

Re: [Public WebGL] texImage2D calls with HTMLVideoElement



On Fri, Aug 13, 2010 at 11:03 AM, Adrienne Walker <enne@google.com> wrote:
> I was looking at the WebGL spec about the tex(Sub)Image2D calls and
> had two questions:
>
> 1) Why do the texImage2D calls that take HTMLMediaElement parameters
> allow the specification of format and type? Along those same lines,
> why is the spec so insistent that image data must be downconverted to
> lower precision if it is specified?

Format (and internalformat) and type are specifiable so that authors
can choose to use less VRAM for a given texture. The spec requires
that the incoming image be converted to the given precision for
repeatability across platforms; it would be bad if on one platform,
uploading to an UNSIGNED_SHORT_5_5_5_1 texture preserved 8 bits of
data per channel, but on another, it dropped bits. An author might
develop on the first platform, expect a certain rendering fidelity,
and then later run on the second platform and find that their game
unexpectedly looked bad.

> The only use case I can imagine is that with a packed format you save
> on upload bandwidth and texture memory at the expense of conversion,
> but only if the HTMLMediaElement is being composited on the CPU, which
> is likely to not be the case for most of those element types in the
> future.  The element's width and height are already implicitly used as
> parameters in the call--why not the format as well?

If a packed format is requested, the conversion can be done on the
GPU, although doing so is a little more involved; the source image or
video element would be bound to a framebuffer object and
glCopyTexSubImage2D used to populate the destination texture with
given internalformat.

Once it was decided (during a recent F2F of the WebGL working group)
to allow the type of the texture to be specified, it was required for
future compatibility to add both the format and internalformat
parameters.

> 2) Regarding the texImage2D call with the HTMLVideoElement, the spec
> is unclear about how to handle poster attributes.  Is this
> intentionally left as an implementation detail?

I'm sure this is an oversight on our part. If you have any suggestions
on additional spec text please let us know.

-Ken

> Forgive me if either of these have been discussed before.  I tried
> searching the email archives, but couldn't turn anything up.
>
> Cheers,
> -Adrienne
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
>
>

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: