I did a webgl shader开发者_如何学JAVA that generate a procedural texture of about 8k * 4k. I need to save this texture to disk. I was wondering if there is some facility to do that. I know it would be possible to write a function that retrieve the texture by block and rebuild it in a 2d canvas to recontruct it, but before doing that I would like to be sure there is not other way.
Anyone ?
Check the File API and the File API Writer for HTML5, you must also keep in mind that your canvas must be untainted (read: no cross-origin images rendered) to read the pixels from it.
With the File API you must read the pixels and write them as a blob directly.
精彩评论