0

I have an application which runs fullscreen on a high resolution display (1920x1080). About 25% of the screen is a StackPanel that scrolls images across the screen. (the X position is animated with double animation)

The scroll is very laggy and jumpy, and with visible tearing. This is running on a brand new high-end gaming laptop, running Win7 64bit.

I don't understand why the performance is so poor. Am I doing something wrong? Does this kind of animation run on the CPU or GPU? Is there a smarter way to scroll images across the screen?

svick
  • 236,525
  • 50
  • 385
  • 514
Shachar Weis
  • 936
  • 2
  • 20
  • 44
  • 2
    Can you show us the code? What kind of images are they? Do you see CPU usage to go up when this happens? Have you tried profiling your application? – svick Nov 03 '11 at 15:15
  • 1
    Why a StackPanel? Try it with a Grid or Canvas. – H H Nov 03 '11 at 15:15
  • How many items are in your StackPanel? And are you using any kind of UI Virutalization? – Rachel Nov 03 '11 at 15:49
  • Is your animated StackPanel inside a laid-out container like a Grid? Animating a container's position within another laid-out container (it sounds like this is what you're doing) will constantly invalidate layout and arrangement, which can cause performance issues. Try putting it inside a Canvas, as Henk mentioned. – Dan Bryant Nov 03 '11 at 16:00

2 Answers2

0

WPF can be hardware-accelerated, but only on newer video card drivers. Some of the onboard, out of box drivers, will default back to software rendering, which can feel really slow and clunky. As for the tearing, that's a normal video card setting, called V-Sync. I would try updating the video card drivers to a proprietary driver (nVidia, AMD, etc.), and enabling vertical sync on the card.

You can check to see if it falls into software, or hardware rendering using the methods explained here.

If that doesn't resolve the issue, the only other possibility I can think of is your animation/rendering is not synced to the GUI.

See this msdn article for more details.

Community
  • 1
  • 1
Brian Deragon
  • 2,929
  • 24
  • 44
0

A trick that I've seen that can get around this issue is to place a 3D object on your page, view it side on and rotate it e.g. for 4 images have a cube with an image set to each side. Yes the rotation still requires GPU and processor time but it is taken care of internally by the WPF animation and so doesn't require interaction with code behind once set rolling.

ChrisBD
  • 9,104
  • 3
  • 22
  • 35