Click here to Skip to main content
Click here to Skip to main content

Tagged as

Increase Performances when Using D3DImage in WPF

, 18 Sep 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Increase Performances when Using D3DImage in WPF
Often when you read articles explaining how to use a D3DImage in your WPF application, you use code which directly handles the CompositorTarget.Rendering event by updating the 3D world... This can lead to performance problems.
 
For example in my application, WPF refreshes the display with a FPS of 160: the handler which recreates the 3D image is then called 160 times a second. No need to refresh this often.
 
The solution I used is to create a Timer which will do it at the FPS I want. Let's say 30FPS for example:
 
public void createTheRenderingWithCorrectFPS(int whichFPS){
   DispatcherTimer _timer = new DispatcherTimer();
   _timer.Interval = TimeSpan.FromMilliseconds(1000d / whichFPS);
   _timer.Start();
   _timer.Tick += new EventHandler(_timer_Tick);
}
void _timer_Tick(object sender, EventArgs e)
{
   //Refresh the 3D scene
}
 
This enables your application to be really more reactive especially that you need to be on the main thread to update the 3D scene...
 
Do you know a better way?

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

jmix90
Software Developer http://wpf-france.fr
France (Metropolitan) France (Metropolitan)
Jonathan creates software, mostly with C#,WPF and XAML.

He really likes to works on every Natural User Interfaces(NUI : multitouch, touchless, etc...) issues.



He is awarded Microsoft MVP in the "Client Application Development" section since 2011.
 

You can check out his WPF/C#/NUI/3D blog http://www.jonathanantoine.com.

He is also the creator of the WPF French community web site : http://wpf-france.fr.

Here is some videos of the projects he has already work on :
Follow on   Twitter

Comments and Discussions

 
GeneralThx ^^ Pinmemberjmix9021-Sep-10 11:32 
GeneralReason for my vote of 4 Basics of 3D Application....good you... PinmemberGPUToaster12-Sep-10 19:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.1 | Last Updated 18 Sep 2010
Article Copyright 2010 by jmix90
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid