[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:46 AM, Gregg Tavares (wrk) <gman@google.com> wrote:
> You can download binary data through XHR though
>     var req = new XMLHttpRequest();
>     req.open("GET", url, true);
>     req.responseType = "arraybuffer";
>     req.onload = function() {
>       var theArrayBuffer = req.response;
>       var buf = gl.createBuffer();
>       gl.bindBuffer(gl.ARRAY_BUFFER, buf);
>       gl.bufferData(gl.ARRAY_BUFFER, theArrayBuffer, gl.STATIC_DRAW);
>     }
>     req.send();

That's useful for things like mesh data, but I don't think it helps
with loading images.  (You'll get back your compressed PNG, and
depending on what you're doing, same-origin restrictions will also get
in the way.)

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