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

Re: [Public WebGL] Loading WebGLBuffer from an HTMLImageElement



On Tue, Apr 12, 2011 at 1:48 PM, Kenneth Russell <kbr@google.com> wrote:
> Uploading an image to be used as vertex data is a hack. You'll only be
> guaranteed lossless data transfer with PNGs. I don't think we would
> want to add these entry points in the general case as they would
> promote poor application development practices. Why do you not want to
> download binary data?

In this case, I want to load a user-provided image to generate a
histogram.  The user-supplied image may be a remote URL, which I can
load and manipulate but not access directly due to same-origin
restrictions.

The first pass of that (per channel) would be to use the pixel data to
generate points.  It could use vertex shader texture sampling, but
there's no guarantee that any vertex texture units exist (and most
current implementations don't implement them at all), so using a
vertex buffer here eliminates the dependency on optional requirements.
 (It's also simpler to implement, and probably faster.)

(I'm not interested in weird hacks like, say, loading mesh data from a
PNG.  That's not very useful--PNG won't be good at compressing it, and
you'd need to compound the hack badly to get anything other than 8-bit
integers out of it.)

> Second, some
> WebGL implementations today do support floating point textures via the
> OES_texture_float extension; see
> http://www.khronos.org/registry/webgl/extensions/ .

I hadn't seen that page.  I suggest adding it to
http://www.khronos.org/webgl/; after some searching I only see it
linked from the wiki.

-- 
Glenn Maynard
-----------------------------------------------------------
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:
unsubscribe public_webgl
-----------------------------------------------------------