![]() |
|
acquire/release_bitmap: Is this valid? |
spork222
Member #7,263
May 2006
|
... while(1) { acquire_screen(); ... //Do drawing stuff here release_screen(); } ... 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. |
spork222
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. |
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. BITMAP*dbuffer; dbuffer=create_bitmap(SCREEN_W,SCREEN_H); *once all that is done you can call the screen draw function* acquire_screen(); 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- |
Kauhiz
Member #4,798
July 2004
|
Quote: most efficient form for rendering. That would be triple buffering... --- |
|