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

Re: [Public WebGL] 2d canvas context to WebGL



Hi Rik

texImage2D takes a parameter of ImageData, HTMLImageElement, HTMLCanvasElement, or HTMLVideoElement

So you just switch the img element for the canvas element

Kind regards
Ben

On 24 April 2013 21:59, Rik Cabanier <cabanier@gmail.com> wrote:
Great!
So Safari and Chrome implement this efficiently? Also is this documented somewhere?


On Wed, Apr 24, 2013 at 1:47 PM, Benoit Jacob <bjacob@mozilla.com> wrote:

A 2D canvas can be passed directly to WebGL texImage2D.

This happens to be slow in Firefox at the moment (the canvas is
currently read back and re-uploaded), but that could probably be fixed
if there is real-world pressure in that direction.

Benoit

On 13-04-24 04:23 PM, Rik Cabanier wrote:
> All,
>
> Sorry if this is already documented but is there a way to efficiently
> use a 2d canvas context in WebGL?
> We've seen cases where people want to apply effects on 2d contexts and
> they're doing this by copying the 2d canvas to a buffer, running a
> shader on it and getting the result back.
> This is an expensive workflow both in time and memory.
>
> Since the 2d canvas is already on the GPU (on most browsers), is there
> a way to directly access it from WebGL?
>
> Thanks!


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