[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 4:45 AM, Vladimir Vukicevic <vladimir@pobox.com> wrote:
> It's a bit roundabout, but you can:
> - Load the image as an image
> - Draw it into an offscreen 2D <canvas> of the same size
> - Use getImageData
> - Use the returned ImageData's data buffer with buffer[Sub]Data
> Requires an extra step with the canvas drawing (and associated extra memory usage), but should be possible.

> ----- Original Message -----
>> It currently doesn't appear possible to load a WebGLBuffer from an
>> image, to use an image as vertex data. I can't do this manually, by
>> writing the image to a 2d Canvas and passing its ImageData to
>> bufferData, due to same-origin restrictions.

That's what I described here: it doesn't work, since getImageData
isn't allowed for cross-origin images.  A direct API can deal properly
with the cross-origin issues, in the same way texImage2D does.

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