DirectX 9
-
I have installed the managed directx sdk version 9. I have written an application in vb.net that displays some very basic artificial life forms that move in flocks around the screen using Microsoft.DirectX.DirectDraw. I am successfully drawing to both surfaces (Microsoft.DirectX.DirectDraw.Surface) and calling the Surface.Flip method to put the buffer surface's content onto the main surface (Surface.Flip makes the surface memory associated with the BackBuffer surface become associated with the front-buffer surface). What I can't manage to do is keep the back surface's content without it dissapearing i.e. I want to carry on overlaying what I am drawing onto it with each flip. I know why it is lost - when a flip is carried out the pixels are blitted to the main surface. I need some way of maintaining it on the back surface. Does anybody know how to do this? Jim
-
I have installed the managed directx sdk version 9. I have written an application in vb.net that displays some very basic artificial life forms that move in flocks around the screen using Microsoft.DirectX.DirectDraw. I am successfully drawing to both surfaces (Microsoft.DirectX.DirectDraw.Surface) and calling the Surface.Flip method to put the buffer surface's content onto the main surface (Surface.Flip makes the surface memory associated with the BackBuffer surface become associated with the front-buffer surface). What I can't manage to do is keep the back surface's content without it dissapearing i.e. I want to carry on overlaying what I am drawing onto it with each flip. I know why it is lost - when a flip is carried out the pixels are blitted to the main surface. I need some way of maintaining it on the back surface. Does anybody know how to do this? Jim
To adapt your engine to this, after the flip, you'd have to copy the image on the surface that's displayed to the back page surface. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
To adapt your engine to this, after the flip, you'd have to copy the image on the surface that's displayed to the back page surface. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks for your reply. I did try doing that using the Surface.Draw method. This "copies" the contents of one surface to another. However it defeats the object of what I am trying to do because it merely performs the same bit block transfer that the Flip method does i.e. transfers not copies. The main problem I have is finding a way to copy the contents of a surface, retain it and draw it back onto a surface. Jim
-
Thanks for your reply. I did try doing that using the Surface.Draw method. This "copies" the contents of one surface to another. However it defeats the object of what I am trying to do because it merely performs the same bit block transfer that the Flip method does i.e. transfers not copies. The main problem I have is finding a way to copy the contents of a surface, retain it and draw it back onto a surface. Jim
Then I don't get what the problem is. In all the code examples I've seen for DX, I've actually had to clear the drawing surface myself before I started drawing the new frame. If I didn't, then I'd se trails of everything. I guess I don't understand the effect your looking for? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Then I don't get what the problem is. In all the code examples I've seen for DX, I've actually had to clear the drawing surface myself before I started drawing the new frame. If I didn't, then I'd se trails of everything. I guess I don't understand the effect your looking for? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Doh, I have made a schoolboy error in my code and I have been clearing the render surface. Thanks for your answer it did point me in the right direction! Jim