preserveDrawingBuffer false - 值得努力吗? [英] preserveDrawingBuffer false - is it worth the effort?

查看:1033
本文介绍了preserveDrawingBuffer false - 值得努力吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的上下文中使用preserveDrawingBuffer时,我们需要自己清理绘图缓冲区。我在我的应用程序中使用了这种技术。

When using preserveDrawingBuffer for our context we need to take care of clearing the drawing buffer by our self. I use this technique in my app.

我读了一些文章说 - 将此标志设置为false可以获得更好的性能。

I read some article that says - setting this flag to false can get better performances.

在我的应用程序设置为false时,在某些情况下我需要自己清理前缓冲区,因为当没有绘图时我们仍然可以看到之前绘制的内容。

In my app when setting to false, in some cases i need to take care of clearing the front buffer by myself because when no drawing is happening we can still see what was drawn before.

我的问题是,现在是否值得将我的应用颠倒过来并覆盖所有案例以获得更好的表现?真的有这么大的提升吗?

My question, is it worth now to turn my app upside down and covering all the cases in order to get better performances? Is it really so much improving ?

当这个标志为真时,是否有任何演示显示不同的表现(并执行 gl.clear( ..))比较为假?

Is there any demo that shows the different in performances when this flag is true (and performing gl.clear(..)) compares to false ?

推荐答案

我知道这已在其他地方得到解答,但我可以找不到......

I know this has been answered elsewhere but I can't find it so ....

preserveDrawingBuffer: false

表示WebGL可以交换缓冲区而不是复制缓冲区。

means WebGL can swap buffers instead of copy buffers.

WebGL画布有2个缓冲区。您正在绘制的那个和正在显示的那个。当绘制网页时,WebGL有2个选项

WebGL canvases have 2 buffers. The one you're drawing to and the one being displayed. When it comes time to draw the webpage WebGL has 2 options


  1. 将绘图缓冲区复制到显示缓冲区。

  1. Copy the drawing buffer to the display buffer.

此操作显然较慢,因为复制数千或数百万像素不是
a免费操作

This operation is slower obviously as copying thousands or millions pixels is not a free operation

交换两个缓冲区。

此操作实际上是即时的,因为除了将
交换为2个变量的内容之外,什么都不需要发生。

This operation is effectively instant as nothing really needs to happen except to swap the contents of 2 variables.

WebGL交换或复制是否取决于浏览器和其他各种设置,但如果 preserveDrawingBuffer false WebGL可以交换,如果它是 true 它不能。

Whether WebGL swaps or copies is up to the browser and various other settings but if preserveDrawingBuffer is false WebGL can swap, if it's true it can't.

如果你想看到一个表演差异,我建议你在手机上试试你的应用程序。确保抗锯齿也关闭,因为抗锯齿需要 resolve 步骤,这是有效的复制操作。

If you'd like to see a perf difference I'd suggested trying your app on mobile phone. Make sure antialiasing is off too since antialiasing requires a resolve step which is effectively copy operation.

这篇关于preserveDrawingBuffer false - 值得努力吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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