将大 webgl 纹理保存到磁盘
我做了一个 webgl 着色器,生成大约 8k * 4k 的程序纹理。我需要将此纹理保存到磁盘。我想知道是否有一些设施可以做到这一点。我知道可以编写一个按块检索纹理并在 2d 画布中重建它的函数来重建它,但在这样做之前我想确保没有其他方法。
有人吗?
I did a webgl shader 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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查文件 API 和 适用于 HTML5 的文件 API 编写器,您还必须记住您的画布必须不受污染(阅读:不渲染跨源图像)从中读取像素。
使用文件 API,您必须读取像素并将它们直接写入为 blob。
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.