WebGL:防止清除颜色缓冲区 [英] WebGL: Prevent color buffer from being cleared

查看:1421
本文介绍了WebGL:防止清除颜色缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使我删除

Even if I remove

gl.clearColor(c[0],c[1],c[2],1.0);
gl.clear(gl.COLOR_BUFFER_BIT );

屏幕在
下一个绘制周期的开始处仍然会被清除。有没有办法防止这种情况发生。
我想要实现某种覆盖效果。

the screen still gets cleared at the beginning of the next draw cycle. Is there a way to prevent this. I´d like to achive some kind of overpaint effect.

推荐答案

创建WebGLRenderingContext时,您可以告诉它以保留绘图缓冲区。

When you create your WebGLRenderingContext you can tell it to preserve the drawing buffer.

gl = someCanvas.getContext("webgl", { preserveDrawingBuffer: true });

默认值是 preserveDrawingBuffer:false ,因为它是在某些情况下更快。

The default is preserveDrawingBuffer: false because it's faster in some cases.

这篇关于WebGL:防止清除颜色缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆