Sign in to follow this  

Question of when to blit

This topic is 4727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When is it the proper time to blit into the primary buffer (or to second then flip). I just noticed that if I blit an image it stays in the screen. Is it wise to only blit an image, such as a background, when change is detected? or should I blit all the images on each iteration of the main loop?

Share this post


Link to post
Share on other sites
It depends..
One problem is that Windows could've invalidated the window contents, which you'd have to handle in order to skip "unnecessary" blits.
Many older games use a technique called dirty rectangles that only tries to copy those back buffer parts that has actually been updated. This doesn't work very well anymore since most of the screen is updated every frame (i.e. when scrolling) and static scenes rarely consume much CPU power anyway.
If you're optimizing a general purpose UI system it might be worth the effort however few games would gain much from this 'trick'.

Share this post


Link to post
Share on other sites
I understand.

But it's easy for me to check if the background has been invalidated. Although I would have to check the other sprites to see if they have been changed because otherwise they would invalidate the background image.

Never mind.

Share this post


Link to post
Share on other sites

This topic is 4727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this