Results 1 to 13 of 13

Thread: Anything I could do to speed up BitBlt?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Unhappy Anything I could do to speed up BitBlt?

    Hey, I missed you all . Yeh, anyways, like the title sais, what can I do? I've heard of using "DoubleBuffering" instead on AutoRedraw, not quite sure what that is all about. Will loading my pictures from harddrive help speed things up, instead of having them all on the form?

    Thanks.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    Double-buffering allows you to draw everything to an off-screen location then draw that buffer to the screen. It eliminates flickering and graphics being visible drawn to the screen. Is that the problem you're having? Why do you need to speed it up? What framerate are you getting currently?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Cool

    No, my graphics don't flicker or anything, I get an amazing 13 frames per second. It's just that I have 766Mhz and If i slow down my computer to say 400Mhz, you could see how slow the graphics become. Not everybody has fast computers yet. Just want to optimize my code as much as possible.
    Last edited by Dude1; Aug 27th, 2002 at 01:35 PM.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    How many things are you blitting/what size/how are you loading?
    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

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    I blit a character, then I have a big background picture larger then the screen, and then use StretchBlt to make it scroll when the character moves. The Background is not big in size about 200KB, it's a jpg. I store all my pictures in pictureboxes on the form, so I don't load anything.

  6. #6
    Junior Member
    Join Date
    Aug 2002
    Location
    Phoenix
    Posts
    30
    From what I've read, stretchbitblt is slower. Why are you using it? BitBlt is all you need for scrolling an image, probly fastest too.
    I'm in college now.

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I think you should try not to use stretchblit... Just blit the bg with BitBlt and see what performance you get
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Darn, I was beaten by about 2 seconds
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Junior Member
    Join Date
    Aug 2002
    Location
    Phoenix
    Posts
    30
    well, if you hurry, you could probly be the first to reply to my Matrix code with commentary.
    I'm in college now.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    But If I use BitBlt, where would I blit my bg too? If I blit it to the form it flickers.

    Before I had this:

    StretchBlt hdc, 0, 0, 2000, 1300, PB.hdc, OfsetX, OfsetY, 2000, 1300, vbSrcCopy

    Now I have this:

    BitBlt Me.hdc, OfsetX, OfsetY, 2000, 1300, Picture5.hdc, 0, 0, vbMergePaint
    BitBlt Me.hdc, OfsetX, OfsetY, 2000, 1300, PB.hdc, 0, 0, vbSrcAnd

    and it is slow

  11. #11
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Code:
    BitBlt hdc, ...
    Z.

  12. #12
    Junior Member
    Join Date
    Aug 2002
    Location
    Phoenix
    Posts
    30
    create a new picture control (called backBuffer, and bitBlt everything to backBuffer.
    Then at the end of the loop, bitBlt backBuffer to me.hdc (or what ever your primary hdc is)

    set backBuffer.visible = false so it don't get seen.
    I'm in college now.

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    Ok I have :

    BitBlt Backbuffer.hdc, -OfsetX, -OfsetY, 2000, 1300, Picture5.hdc, 0, 0, vbMergePaint
    BitBlt Backbuffer.hdc, -OfsetX, -OfsetY, 2000, 1300, PB.hdc, 0, 0, vbSrcAnd

    the ofset is negative so the bg scrolls against the character, not with.

    Now I blit the backbuffer to me:

    'BitBlt Me.hdc, -OfsetX, -OfsetY, 2000, 1300, Picture5.hdc, 0, 0, vbMergePaint
    BitBlt Me.hdc, -OfsetX, -OfsetY, 2000, 1300, Backbuffer.hdc, 0, 0, vbSrcAnd

    but what do I use for the backbuffer mask? If I use picture5, same as bg, the game is slow.

    Thanks again.

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