Jump to content
  • Advertisement
Sign in to follow this  

Control when and how often Draw is invoked

This topic is 2748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I am creating an application which renders both to a backbuffer and to a rendertarget. The raster data from the rendertarget is copied to an output device (Blackmagic Decklink) so I can have SDI video output from my XNA application.

My problem is that the Draw method is called only when the game IsActive. When the game window is minimized, Draw is not called at all. When there are performance issues on the graphics device, Draw is called less often. This is a problem, because I need a constant 50 fps supply to output a stable SDI video signal on my video output card.

My application is working perfectly when the game window has focus.

How can I force my custom Game (I inheritied from Game) to force a Draw whenever my ouput card requests it? (My output card raises an event 50 times a second on my Game object).

I have tried to Draw my spritebatch manually (not from the overridden Draw of my Game object), however this most often fails when trying to access a disposed resource (such as a vertex buffer or depth stencil). It seems that the XNA Game ensures that all required resources are not disposed before calling its Draw method.

I can see two solutions, but I don't know if and how they can be implemented in XNA:
1. Force Game to Draw whenever I signal it with a ManualResetEvent, but this has to be done even if the Game is not active and when there are performance issues.
2. Call Draw on my spritebatch directly (not from the Game Draw method), without failing with an exception such as DynamicVertexBuffer cannot be used because it is disposed.

I appreciate any help and thank you in advance,

Reuben Sant

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!