Results 1 to 8 of 8

Thread: Real-Time Graphics... ?

  1. #1

    Thread Starter
    Addicted Member Dim A's Avatar
    Join Date
    Jul 2000
    Posts
    201

    Real-Time Graphics... ?

    Anyone have a simple example of double buffering to eliminate the flashing you get with updating graphics too quickly?

    - Dim A

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    With bitblt it's easy if this is what you use...

    Bitblt everything to invisible picturebox, with autoredraw on the picturebox.
    Bitblt unseen picturebox onto "seen" picturebox.
    Clear the invisible picturebox.

    With directdraw you create a surface, get a DDSCAPS object and set it's lCaps to ddscaps_backbuffer, and set the primary's lBackBuffer count to 1. Then you set another surface (your backbuffer) to Primary.GetAttachedSurface(DDSCAPS Object)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    You can use the API Viewer to see how to declare BitBlt... there are lots of articles on that around the net so just search a bit
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    And I've got a tutorial, if you're interested.

    http://vbden.tripod.com/articles/invmask.htm
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5
    Lively Member
    Join Date
    Sep 2001
    Posts
    74

    I've done that recently

    What you need is one picturebox to be the gameing field with the AutoRedraw set to true that way you don't need a backbuffered picture box.

    What I use is one picture box containing the background for the game and then two for each sprite and mask that I want to move around (or you can read them from disk). You use the bit blit function to drop the background into the main game picturebox then the mask of the first sprite, then the sprite of the first sprite and continue like that for each additional sprite. You should note that the second sprite will be on top of the first one if they overlap at anypoint. then after drawing all the sprites refresh the picturebox (picture1.refresh) there will be no flashing. Also if you did what I did at first and draw both masks then both sprites (like some tutorials show) you will have a problem because they will become transparent when they overlap.
    All will fall before the might of the Black Sashi...

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Actually I believe there is a noticeable flash if you do this on a slower computer...
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Lively Member
    Join Date
    Sep 2001
    Posts
    74

    How slow

    Not that I know of. It will work flawlessly on a pentium 266. Any slower then that and why would you be designing software for it anyway?

    Although I've heard it said that if your designing a game that has a very great number of sprites on the screen at once that this technique will execute slightly slower then if you were using a true backbuffer.
    All will fall before the might of the Black Sashi...

  8. #8
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Works fine on a P133 too

    (yeah yeah, I should upgrade, but hey, it still works and it's great for testing my programs and games speeds )





    (and the last one is just a bs excuse, I just don't have the money right now )
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width