Webgl update region using viewport+scissor

风流意气都作罢 提交于 2019-12-06 11:44:41
Juan Mellado

You can use the preserveDrawingBuffer attribute:

gl = canvas.getContext("experimental-webgl", { preserveDrawingBuffer: true });

It isn't recommended to use this in production. The WebGL specifications states:

While it is sometimes desirable to preserve the drawing buffer, it can cause significant performance loss on some platforms. Whenever possible this flag should remain false and other techniques used. Techniques like synchronous drawing buffer access (e.g., calling readPixels or toDataURL in the same function that renders to the drawing buffer) can be used to get the contents of the drawing buffer. If the author needs to render to the same drawing buffer over a series of calls, a Framebuffer Object can be used.

This SO question contains also relevant information regarding preserveDrawingBuffer: When WebGL decide to update the display?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!