WPF视频撕裂在Windows XP [英] WPF video tearing on Windows XP

查看:175
本文介绍了WPF视频撕裂在Windows XP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建使用呈现约50 3D元素和动画相机以现场周围移动C#WPF应用程序。

I've created a WPF application using C# that renders about 50 3D elements and animates the camera in order to move around the scene.

虽然它的所有作品,我注意到的摄像机移动,出现难看的视频撕裂。

While it all works, I've noticed as the camera moves, ugly video tearing occurs.

我很清楚撕裂的标准原因,即应用程序在从监视器/适配器垂直同步不同的速率更新帧。

I'm well aware of the standard cause of tearing, ie the application is updating frames at a different rate from the monitor/adapter vertical sync.

我也看到了,在WPF的默认屏幕更新率是每秒和60帧在XP WPF更新的不考虑montior垂直同步

I've also read that the default screen update rate in WPF is 60 frames per second and that on XP WPF updates without regard to the montior v-sync.

对于某些场景撕裂是不太明显,但通常它分散注意力,足以成为一个真正的问题。

For certain scenes the tearing is less noticeable, but often it is distracting enough to be a real problem.

我真的希望有分辨率下,所有Windows窗体后,已经有双缓冲多年。移动到WPF是actally许多类型的应用程序是一种倒退,如果没有解决。

I'm really hoping there is a resolution, after all Windows Forms has had double buffering for years. Moving to WPF is actally a backward step for many types of application if there is no resolution.

因此,在Windows XP中,我该怎么配置WPF删除撕裂?

So, on Windows XP, how can I configure WPF to remove tearing?

我在找更有帮助的答案,然后移动到Vista。这简直是​​出了很多这个应用程序的未来用户的问题。

I'm looking for more helpful answers then "move to Vista". This is simply out of the question for many of the future users of this application.

推荐答案

暂时还没有答案,想必的开发WPF那里别人已经看到这个问题。

No answers yet, surely with the number of WPF developers out there someone else has seen this problem?

在我调查研究其间/读多一些和所遇到的的 Timeline.DesiredFrameRate 财产。

In the meantime I've investigated/read some more and have come across the Timeline.DesiredFrameRate property.

通过我的显示器为50Hz垂直刷新率运行我试过,希望这将带来的东西同步将其设置为50 FPS。不幸的是这对撕裂无影响。

With my display running at 50hz vertical refresh I tried setting this to 50 FPS in the hope this would brings things in sync. Unfortunately this had no effect on the tearing.

不过,我确实有使用BeginAnimation将它应用到我创建一个单一的特定的动画(代码)()。我不知道这会如何影响全局的帧率都没有。

However, I did have to apply it to a single specific animation I created (in code) using BeginAnimation(). I'm not sure how this would affect a "global" framerate at all.

相反,我没有料想到会需要一个更加全球化的层次要做到这一点,说。在视口中,但是我找不到视对象DesiredFramerate属性。

Instead, I would have expected to need to do this at a more global level, say on the viewport, however I couldn't find DesiredFramerate property on the viewport object.

另一个方面看可能是的 RenderCapability.Tier 但我还没有时间详细看呢。

Another area to look at could be the RenderCapability.Tier but I haven't had the time to look in detail yet.

[更新]

没有解决方案,但一个有用的技巧。 (对于在视口中所有的动画即)设置DesiredFramerate全球范围可以覆盖PropertyMetadata为
Timeline.DesiredFrameRateProperty依赖属性:

No solution but a useful tip. To set the DesiredFramerate globally (ie for all animations in the viewport) you can override the PropertyMetadata for the Timeline.DesiredFrameRateProperty dependency property:

// Set the global desired framerate to 50 frames per second
Startup += delegate(object sender, StartupEventArgs e)
{
Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),
     new PropertyMetadata(50));
};



这是最好的把这个标准WPF应用程序类的构造函数。

It's best to place this in the constructor of the standard WPF Application class.

不幸的是这并没有解决我的问题,因为即使将其设置为FPS,它不能准确地同步与足够显示器垂直同步。

Unfortunately this didn't solve my problem because even setting it to FPS, it must not be synced accurately enough with monitor v-sync.

这是很方便的了解,虽然,特别是如果你已经缓慢移动的动画,并希望通过设定FPS低得多,那么默认的60fps,以节省CPU的使用率。

It is handy to know about though, particularly if you have slow moving animations and want to save CPU usage by setting the FPS much lower then the default 60fps.

[更新]

DesireFrameRate设置为一些很高的价值,如100 +似乎减少但不能消除闪烁。但一大缺点是CPU(我4哟PC上)变至35%。

Setting the DesireFrameRate to some very high value such as 100+ seems to reduce but not remove the flicker. One big drawback however is that the CPU (on my 4 yo PC) goes to 35%.

这篇关于WPF视频撕裂在Windows XP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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