Jump to content

  • Log In with Google      Sign In   
  • Create Account


maya18222

Member Since 30 May 2008
Offline Last Active Apr 23 2013 05:34 PM
-----

Posts I've Made

In Topic: WPF - Trying to get a timer with an interval of less than ~16ms

01 January 2013 - 10:59 AM

Thank you for the replies. Im actually trying to come up with a way of updating winForms controls in a wpf application at a rate of several hundred FPS.

My first approach was just

DispatcherTimer dt = new DispatcherTimer();
dt.Interval = TimeSpan.FromMilliseconds(1);
dt.Tick += new EventHandler(OnProcessViewports);
dt.Start();

which as mentioned, gives me arounf 60 FPS.

Ive now tried

Loaded += (s, a) =>
		    {
			    BackgroundWorker bw = new BackgroundWorker();
			    bw.DoWork += (ss, aa) =>
			    {
				    while (true)
				    {
					    Thread.Sleep(16);
					    Dispatcher.Invoke(new EventHandler(OnProcessViewports), new object[] { null, null });
				    }
			    };
			    bw.RunWorkerAsync();
		    };

This works, and gives me several hundred FPS (with a low sleep time), which is what I wanted. But, something odd is happeneing with the CPU usage. If I set the sleep time to about 16ms, then I get around ~55FPS, but, .. the CPU usage goes to about 20-30%.

using the dispatch timer approach as coded above, I get 60 FPS, and around 2-3% CPU usage. Any ideas why this would be the case? Both versions run at around 60FPS, yet the 2nd approach uses a lot more CPU usage.


In Topic: WPF : How is this code working?

23 September 2012 - 03:31 PM

Ah, I see. I didnt realise it was doing stuff behind the scenes like that.

In Topic: WPF : How is this code working?

21 September 2012 - 12:36 PM

Yes but both the ContentControl and the listbox are being bound to an ObservableCollection. All the ContentControl sees is the ObservableCollection. How is it somehow seeing the current item in the listbox/Selector/Items.

In Topic: How to view Depth/colour targets in vs2012 Graphics Debugger

16 September 2012 - 02:10 AM

so you're able to select a RTV or DSV, and still see the scene being constructed in those views as you flip through draw calls that render into those views?

Are you also able to see the depth buffer?

Edit - I've managed to view the depth buffer to some extent, by selected the DSV Tex2D resource, and then setting the Colour format to some kind of floating point format in the image properties window, ...but its still not really useable, as apparently all image editing is done in 8bits per channel, not floating point.

Attached File  Untitled.jpg   149.34KB   42 downloads

In Topic: Visual Studio C#

19 August 2012 - 03:46 AM

1. In C# you don't. In general when you add a reference you add the debug version. When you are ready to release just include the release version.
2. The only real difference between the two is when in debug the optimizations are disabled. This makes it harder to debug. But you can include either one and they will both work.


But lets say you're working on a project with lots of references, and if as you say, you just set the debug references, but having to change these to the release versions each time you want to build a release version (which could be quite often, especially if you're keeping track on performance), is a real pain.

PARTNERS