|
-
Aug 27th, 2002, 12:40 PM
#1
Thread Starter
Addicted Member
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.
-
Aug 27th, 2002, 01:13 PM
#2
Addicted Member
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?
-
Aug 27th, 2002, 01:27 PM
#3
Thread Starter
Addicted Member
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.
-
Aug 27th, 2002, 02:54 PM
#4
Good Ol' Platypus
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)
-
Aug 27th, 2002, 02:59 PM
#5
Thread Starter
Addicted Member
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.
-
Aug 27th, 2002, 03:09 PM
#6
Junior Member
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.
-
Aug 27th, 2002, 03:10 PM
#7
Good Ol' Platypus
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)
-
Aug 27th, 2002, 03:10 PM
#8
Good Ol' Platypus
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)
-
Aug 27th, 2002, 03:17 PM
#9
Junior Member
well, if you hurry, you could probly be the first to reply to my Matrix code with commentary.
-
Aug 27th, 2002, 03:50 PM
#10
Thread Starter
Addicted Member
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
-
Aug 27th, 2002, 03:58 PM
#11
Frenzied Member
-
Aug 27th, 2002, 03:59 PM
#12
Junior Member
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.
-
Aug 27th, 2002, 04:22 PM
#13
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|