Guest JellyDonutMan Posted February 2, 2003 Posted February 2, 2003 Having a problem with DirectX 9 and VB.NET displaying only 50 FPS max ... This is the code I'm using to get the FPS Public Function GetFPS() CurrentTime = Environment.TickCount() Frames += 1 If CurrentTime - LastTime >= 1000 Then FPS = Frames LastTime = CurrentTime Frames = 0 End If Return FPS End Function Quote
*Experts* Nerseus Posted February 2, 2003 *Experts* Posted February 2, 2003 If you're setting your device's present parameter's interval to anything but Immediate, you may be locking yourself into the monitor refresh. If you change the value to One, you should see it pick up: presentParams.PresentationInterval = PresentInterval.One; Check out the values for your swap effect and interval in the help for more info. You may want to use the C++ documentation if the C# docs aren't helpful enough. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Jelly Donut Man Posted February 2, 2003 Posted February 2, 2003 Ok, well now the max FPS I'm getting is 60 instead of 50 :-\ my swap effect is: PresentParams.SwapEffect = SwapEffect.Discard Quote
*Experts* Nerseus Posted February 2, 2003 *Experts* Posted February 2, 2003 ...did you change your PresentInterval as well? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Jelly Donut Man Posted February 2, 2003 Posted February 2, 2003 PresentParams.Windowed = True PresentParams.SwapEffect = SwapEffect.Discard PresentParams.PresentationInterval = PresentInterval.One Device = New Device(0, DeviceType.Hardware, Me.Handle, CreateFlags.HardwareVertexProcessing, PresentParams) Is what I have. Quote
Jelly Donut Man Posted February 2, 2003 Posted February 2, 2003 Umm.. I changed it to PresentParams.PresentationInterval = PresentInterval.Immediate And now I'm getting 1700-2000 fps with a blank screen about 300x300 .. Is that normal, and what does this change exactly? Quote
*Experts* Nerseus Posted February 2, 2003 *Experts* Posted February 2, 2003 If One, it's syncing up each refresh to the monitor's refresh. If your monitor is at 100hz, you can expect 50 FPS to be the max, give or take. If you had a really fast machine and graphics card, you might get closer to 100 FPS, but you wouldn't go faster than the refresh. By changing it to Immediate, you're saying don't wait for the monitor to refresh, flip the backbuffer immediately. I'd read up on the "tearing" effects that might get introduced using certain PresentIntervals and SwapEffects. Also, anything about 30FPS is generally considered acceptable though 60FPS or higher is ideal. 50 FPS shouldn't be a worry. I'd wait til you add some objects and other logic to your app's main loop then see what FPS you're getting. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Jelly Donut Man Posted February 2, 2003 Posted February 2, 2003 So basicly setting it to One is enabling VSync, more or less ... Or is there another option for that? Quote
*Experts* Nerseus Posted February 3, 2003 *Experts* Posted February 3, 2003 I haven't seen any other option similar to the old D3DSWAPEFFECT_COPY_VSYNC. Just by playing around did I find the PresentInterval (which used to be reserved for FullScreen) and read up on the SwapEffect (some good info in the help for C# on this). -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.