撕破HTML5画布? [英] Tearing in HTML5 canvas?

查看:250
本文介绍了撕破HTML5画布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用HTML5 canvas 元素制作一个小游戏。它工作伟大,除了它有一个滚动的背景与明显撕裂发生在Firefox和Chromium浏览器在Ubuntu。我相信它的缓冲,因为没有任何闪烁我期望;只是撕裂。有没有办法解决这个或时间渲染到最后屏幕刷新后?

I'm making a small game using the HTML5 canvas element. It works great, except that it has a scrolling background with obvious tearing happening in Firefox and Chromium browsers in Ubuntu. I'm pretty sure it's buffered because there isn't any of the flickering I'd expect; just tearing. Is there any way to work around this or time rendering to right after the last screen refresh?

推荐答案

目前没有办法控制画布元素的实际重绘(如果有的话,实际上可以帮助提高性能)。因此,我们只能希望浏览器实际上做了一些聪明的事情,而不是像你的情况下拧紧。

Currently there is no way to control the actual repainting of a canvas element(which if there was, could actually help in increasing performance I guess). So one can only hope that the browser actually does something intelligent, rather than screwing up like in your case.

我自己对canvas元素有很多经验,知道它的怪癖。现在我遇到了几种重绘滞后,其中显然幕后的实际数字是正确的和平滑的,但图形仍然有一些跳跃的行为,事实上是真的

I myself have quite some experience with the canvas element and know of its quirks. I ran into some kind of "repaint lag" several times by now, where obviously the actual numbers behind the scenes are correct and "smooth", but the graphics still have a somewhat "jumpy" behavior, which in fact is really annoying.

只有我能想象的,在您的情况下可以有效果,在您的显卡的驱动程序设置中激活VSync。

Only thing I can imagine that could have an effect in your case, is activating VSync in the driver settings of your Graphics Card.

如果你想提供一个链接到你的游戏,这也可能是有帮助的,因为我也在这里运行Ubuntu。

If you'd like to provide a link to your game that might be helpful too, since I'm also running Ubuntu here.

这篇关于撕破HTML5画布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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