Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DirectX 9

DirectX 9

Scheduled Pinned Locked Moved Visual Basic
graphicscsharpgame-devperformance
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jim Taylor
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • J Jim Taylor

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        J Offline
        J Offline
        Jim Taylor
        wrote on last edited by
        #3

        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

        D 1 Reply Last reply
        0
        • J Jim Taylor

          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

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • D Dave Kreskowiak

            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

            J Offline
            J Offline
            Jim Taylor
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups