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

Re: [Public WebGL] WebGL in Workers

On Thu, May 3, 2012 at 8:53 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
On 5/3/12 11:33 PM, Glenn Maynard wrote:
I think everyone wants WebGL in workers, but nobody's really sure how to
proceed, since it's hard to get HTMLImageElement in workers...

We don't really need HTMLImageElement in workers.  The only places where WebGL takes an HTMLImageElement one can pass the corresponding ImageData.  We could add some sort of convenience function for getting said ImageData out of an HTMLImageElement, if desired, to avoid having to roundtrip through a 2d canvas context.

Alternately, in the interests of efficiency, we could make it possible to pass an HTMLImageElement to a worker and get an opaque thing that represents its data (actual data plus format information) to avoid forcing conversions to RGBA.

Another alternative, Add "Picture" which would be Image minus the HTMLElement parts

You could think of as

class Picture {    

// HTMLImageElement uses a Picture
class HTMLImageElement : public HTMLElement {

  Picture* picture;

Apparently there are issues using any kind of DOM element in a Worker but separating the data part of Image from Image would let you use the data only part in a Worker.