I am drawing with directx9, windowed mode. The drawing is in dialog box . The drawing is a simple animation, and the user have option to pause the animation from button click. The problem is following:
1) The animation is paused
2) User minimizes main application
3) when main application window is restored , the drawing is lost i.e the dialog is empty
The drawing is like this ( pseudo code) :
OnBtnClikedPause()
{
paused = true;
}
bool isRunning= true;
while (isRunning)
{
MSG msg;
if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
isRunning= false;
continue;
}
}
else
{
if( ! paused )
{
scene.Update();
BeginScene();
ClearBuffers();
Draw();
EndScene();
Present();
}
}
}
The updating and drawing of the scenegraph is only if the animation is not paused.If I change the code , so that I am drawing all the time and only updating if not paused , then I am no longer seeing this problem when restoring back :
if( !paused )
{
scene.Update();
}
BeginScene();
ClearBuffers();
Draw();
EndScene();
Present();
So I don't get it why the rendering in the dialog is lost ?
anyone have idea how to solve the problem without drawing all the time






