PresentParameters pParams = new PresentParameters();
pParams.AutoDepthStencilFormat = DepthFormat.D16;
pParams.Windowed = !fullscreen;
pParams.SwapEffect = SwapEffect.Discard;
pParams.EnableAutoDepthStencil = true;
pParams.MultiSample = MultiSampleType.FourSamples;
pParams.PresentationInterval = PresentInterval.Immediate;
CreateFlags flags = 0;
_devCaps = Manager.GetDeviceCaps(Manager.Adapters.Default.Adapter, DeviceType.Hardware);
if (_devCaps.DeviceCaps.SupportsHardwareTransformAndLight)
{
flags = CreateFlags.HardwareVertexProcessing;
if (_devCaps.DeviceCaps.SupportsPureDevice)
flags |= CreateFlags.PureDevice;
}
else
flags = CreateFlags.SoftwareVertexProcessing;
if (fullscreen)
{
pParams.BackBufferCount = 1;
pParams.BackBufferFormat = Manager.Adapters.Default.CurrentDisplayMode.Format;
pParams.BackBufferHeight = 768;
pParams.BackBufferWidth = 1024;
}
_device = new Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, c, flags, pParams);
[MDX] Very low fps in window, fine fullscreen?
The topic generally sums it up. When I run my application in a window, the fps is 32. It used to be 60 (and 140 odd with immediate present interval), but now I can't get it higher than 32, and I have no idea what I've changed. Looked at the fps in pix shows it goes... 60-57-56-30-17-16-20-60-rinse and repeat. Pretty bizzare, because I don't recall changing anything significant.
When I run fullscreen, its a steady 60 - with very little flucuation.
Any ideas on what this could be? I use an Application.DoEvents() loop if that helps, and here are my present params:
Fire suggestions at me, this is driving me insane :(
Ok, just ran windowed again, and now its 64 fps.. and I haven't changed anything o.O It seems to be another app causing this - could it be because i use app.doevents() ?
Check Task Manager and see what else is running. Exit every other application and see how things run then.
Are you using a Debug Build or Release? For any performance monitoring you should use the Release version of DirectX and a Release build of your Exe.
DoEvents isn't very efficient. I wrote a tutorial on a better message loop:
Message Loop Tutorial (.Net)
Are you using a Debug Build or Release? For any performance monitoring you should use the Release version of DirectX and a Release build of your Exe.
DoEvents isn't very efficient. I wrote a tutorial on a better message loop:
Message Loop Tutorial (.Net)
First of all, get rid of Application.DoEvents(). Every call to the method will increase the size of your application in memory. If you open your task manager and run your program you will notice this.
Use Tom Miller's "Good" Render loop to solve this.
I will look at the rest of your code when I wake up.
I hope this helps.
Take care.
Use Tom Miller's "Good" Render loop to solve this.
I will look at the rest of your code when I wake up.
I hope this helps.
Take care.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement