FPS Problem in DirectX

  • Thread starter Thread starter JellyDonutMan
  • Start date Start date
J

JellyDonutMan

Guest
Having a problem with DirectX 9 and VB.NET displaying only 50 FPS max ... This is the code Im using to get the FPS
Code:
    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
 
If youre setting your devices present parameters 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:
C#:
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 arent helpful enough.

-Nerseus
 
Code:
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.
 
Umm.. I changed it to
Code:
PresentParams.PresentationInterval = PresentInterval.Immediate
And now Im getting 1700-2000 fps with a blank screen about 300x300 .. Is that normal, and what does this change exactly?
 
If One, its syncing up each refresh to the monitors 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 wouldnt go faster than the refresh.

By changing it to Immediate, youre saying dont wait for the monitor to refresh, flip the backbuffer immediately.

Id 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 shouldnt be a worry. Id wait til you add some objects and other logic to your apps main loop then see what FPS youre getting.

-nerseus
 
I havent 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
 
Back
Top