- Online Community Forums » Programming Questions » acquire/release_bitmap: Is this valid?

This thread is locked; no one can reply to it. rss feed Print
acquire/release_bitmap: Is this valid?
Member #7,263
May 2006

  ... //Do drawing stuff here

I was thinking that there has to be more efficient ways of drawing than backbuffers or double buffering- is this little code snippet valid? According to the documentation, acquire_screen can mess things up if you don't use it correctly.

Matthew Leverton
Supreme Loser
January 1999

Sure you can draw a bunch of stuff directly to the screen if you don't mind artifacts, shearing, and just a horrible all around experience.

When you use those functions the only thing between them must be drawing operations to the bitmap you've locked.

Member #7,263
May 2006

Wow, that was fast.

That's what I meant. What I wanted to do was instead of drawing stuff to a backbuffer and then blitting it to the screen, to lock the screen and draw to it directly, then clear it at the beginning of the cycle. Is that any more efficient than a backbuffer?

Richard Phipps
Member #1,632
November 2001

Unless you are drawing very little then no. :) Any form of scrolling will look bad without some form of double buffer or page flipping.

Kris Asick
Member #1,424
July 2001

By removing the buffering step, you are effectively removing the guarantee that the screen itself will only update when you tell it to. Otherwise, the screen could update at any moment, rendering only as much (or as little) as is currently on the screen bitmap surface.

Double Buffer or Page Flipping is almost a necessity...

...however, there's another update method called "Dirty Rectangles" where you only update areas that have changed. I personally don't recommend it, but if framerate is a huge issue and you're not doing full-screen scrolling, it will deliver, but it will also be the poorest quality refreshing you could hope to achieve, and more complicated to implement.

--- Kris Asick (Gemini)

--- Kris Asick (Gemini)

Taiko Keiji
Member #8,307
February 2007

If what your looking for is a quick way to draw to the screen then you should use a double buffer.

*initialize things and do all your coding here*
*then when you draw just draw to the buffer*

*dont forget to create the buffer*
draw_sprite(dbuffer,sprite*,int x, inty);

*once all that is done you can call the screen draw function*


It really simplifies your screen drawing code, as you can see it's only three lines. I find this to be the easiest and most efficient form for rendering.

Life could be better, machines could program themselves.

Taiko Keiji-

Member #4,798
July 2004


most efficient form for rendering.

That would be triple buffering...


Go to: