Control when and how often Draw is invoked

Started by
-1 comments, last by ReubenSant 13 years ago
Hello,

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

This topic is closed to new replies.

Advertisement