[SlimDX]Program seems to jump
I am running on a fairly new system (Duo T3700 with Geforce 8600GS) and I am using a tight rendering loop like the following:
while No Messages in Que
Clear()
RenderGame()
Present()
endWhile
I have noticed that my program seems to jump every few frames and I am wondering what this could be due to. Any Ideas on how to fix this problem?
how about this:
The program doesn't get really choppy, like a lagging game would. It just slows down from 60fps to about 15fps every second or so. I don't know why.
and also, how do I profile my application? I have never done this before.
EDIT: I tried rendering 100 fonts and still got about the same FPS rate so I don't think it has to do with my computer being slow.
//Main rendering functionprivate void Render(long ellapsed, long total) { graphicsDevice.Clear ( ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Black.ToArgb(), 1.0f, 0 ); graphicsDevice.BeginScene (); humanView.VRender ( ellapsed, total ); graphicsDevice.EndScene (); graphicsDevice.Present(); }//Human View VRender()public virtual void VRender(long ellapsed, long total) { //Draw the elements in reverse order NOTE: there are no screen elements in this list now foreach (IScreenElement se in screenElements) { se.VRender ( ellapsed, total ); } drawSprite.Begin ( SpriteFlags.AlphaBlend); drawFont.DrawString ( drawSprite, "Hello World", x, y, System.Drawing.Color.Red.ToArgb () ); drawSprite.End (); y++; x++; }
The program doesn't get really choppy, like a lagging game would. It just slows down from 60fps to about 15fps every second or so. I don't know why.
and also, how do I profile my application? I have never done this before.
EDIT: I tried rendering 100 fonts and still got about the same FPS rate so I don't think it has to do with my computer being slow.
Quote:Original post by jdub
how about this:
*** Source Snippet Removed ***
The program doesn't get really choppy, like a lagging game would. It just slows down from 60fps to about 15fps every second or so. I don't know why.
and also, how do I profile my application? I have never done this before.
EDIT: I tried rendering 100 fonts and still got about the same FPS rate so I don't think it has to do with my computer being slow.
Yeah. That's about as useful as posting no code at all. Honestly, profile first.
* Do any of the samples seem to jump?
* Do other, non SlimDX programs seem to jump?
* What D3D present interval are you using?
* Do other, non SlimDX programs seem to jump?
* What D3D present interval are you using?
What do set your device's present parameters too? I've seen PresentInterval.Default falling back to 30fps or 15fps at times and it may be a better idea to use PresentInterval.One
Another thing may be if all your screen elements use Sprite.Begin and Sprite.End as well. Given what little source you have shown, there is a strong chance you could reuse the same Sprite for all your screen elements having a single Begin and End pair.
Showing your render loop itself may also help.
Regards,
ViLiO
Another thing may be if all your screen elements use Sprite.Begin and Sprite.End as well. Given what little source you have shown, there is a strong chance you could reuse the same Sprite for all your screen elements having a single Begin and End pair.
Showing your render loop itself may also help.
Regards,
ViLiO
Some other thoughts: if you're debugging inside Visual Studio, you could see a significant slow down, especially if you have unmanaged debugging turned on.
Are you using the recommended application message loop, or trying to do your drawing inside of OnPaint or similar?
If you're using the sample framework, you should know that by default it has a fixed time step so you won't be able to exceed it until you disable it.
Are you using the recommended application message loop, or trying to do your drawing inside of OnPaint or similar?
If you're using the sample framework, you should know that by default it has a fixed time step so you won't be able to exceed it until you disable it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement