Reading image bytes to a PNG in a typed array

2013-01-14 Thread Florian Bösch
Having a texture in WebGL and wanting to encode it into a typed array as PNG, I have found that the only way to do it is the following convoluted method. 1) Create canvas, set to desired size 2) Create 2D context 3) Create imageData object 4) Create a WebGL framebuffer object 5) Attach texture as

Re: Reading image bytes to a PNG in a typed array

2013-01-14 Thread Anne van Kesteren
On Mon, Jan 14, 2013 at 1:20 PM, Florian Bösch pya...@gmail.com wrote: Having a texture in WebGL and wanting to encode it into a typed array as PNG, I have found that the only way to do it is the following convoluted method. Could you list the use cases?

Re: Reading image bytes to a PNG in a typed array

2013-01-14 Thread Florian Bösch
The usecase is that I write a productivity application using WebGL which has a need to bundle images residing in computed textures into one archive (tar, zip etc.). - The images belong together (such as normal, height, tangent, specular color, specular power, albedo etc.) - The archive has to

Re: Reading image bytes to a PNG in a typed array

2013-01-14 Thread Glenn Maynard
On Mon, Jan 14, 2013 at 6:20 AM, Florian Bösch pya...@gmail.com wrote: 1) Create canvas, set to desired size 2) Create 2D context 3) Create imageData object 4) Create a WebGL framebuffer object 5) Attach texture as color target to framebuffer 6) read back pixels into canvas2d's

Re: Reading image bytes to a PNG in a typed array

2013-01-14 Thread Florian Bösch
On Mon, Jan 14, 2013 at 4:00 PM, Glenn Maynard gl...@zewt.org wrote: You want toBlob, not toDataURL. So how would I stick a blob into an arraybuffer?

Re: Reading image bytes to a PNG in a typed array

2013-01-14 Thread Glenn Maynard
On Mon, Jan 14, 2013 at 9:04 AM, Florian Bösch pya...@gmail.com wrote: On Mon, Jan 14, 2013 at 4:00 PM, Glenn Maynard gl...@zewt.org wrote: You want toBlob, not toDataURL. So how would I stick a blob into an arraybuffer? http://dev.w3.org/2006/webapi/FileAPI/#dfn-filereader -- Glenn