|
|
View previous topic - View next topic |
Author |
Message |
Terry Spectral Form
Joined: 16 Jun 2002 Posts: 798 Location: Dublin, Ireland
|
Posted: Wed Jun 30, 2004 5:07 pm Post subject: Triple Buffering |
[quote] |
|
I'm coding coding with Allegro (with Mingw), and currently, I update the screen like this (pseudocode, I don't have the source at hand)
Code: |
while(){
draw_on_back_buffer();
vsync();
copy_to_SCREEN();
input();
//^All Game logic updated here
}
|
If that makes sense :) Basically just double buffering. Perhaps I'm doing something wrong, but this approach always leaves scrolling a little jerky - it's difficult to explain exactly how. I've heard only briefly of something called triple buffering, but I've no idea what it is.
Is anybody familar with the problem, and can they offer any suggestions?
|
|
Back to top |
|
|
white_door Icemonkey
Joined: 30 May 2002 Posts: 243 Location: New Zealand
|
Posted: Wed Jun 30, 2004 8:03 pm Post subject: |
[quote] |
|
Well if you don't already have some code to monitor and cap/control the speed of drawing, I really suggest you do add some. A man can not live on vsync alone.
Anyway about triple buffering, it not like double buffering at all its more like page flipping. With page flipping you have two video pages, one that is displayed and the other you are drawing to. The only difference with triple buffering is you have three video pages. One that is displayed, one that is about to be displayed, and finally the one that you are drawing too.
When you are finished drawing to a page, you request that the video card display the next page on the moment of the next vsync. The key is you don't have to wait for a vsync... you just keep going and in its own time the video card will do the page flip for you.
Naturally... this method means you are drawing directly to video memory for each and every thing you draw to the screen. Its even worse if you are reading from the video memory. (translucent blending for example) In addition, triple buffering is hardware dependant and you will not work on all gfx cards. So you may need to have a backup rendering method.
I strongly suggest you make a system where you can switch between several different rendering methods in your game, and profile the results. Personally I found that boring double buffering gave me the most stable results.
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Wed Jun 30, 2004 9:22 pm Post subject: |
[quote] |
|
Sometimes Triple Buffering isn't implemented with two pages - it can be implemented with two levels of buffering. The most common form I've run into is having an offscreen buffer for your map and entities, and then blitting that onto the backbuffer every frame and drawing your HUD over it. That way you don't have to redraw the entire map every frame.
It really isn't all that useful nowadays, but games like Commander Keen used a similar technique to get around the generally horrible video performance of olden-days computers.
|
|
Back to top |
|
|
|
Page 1 of 1 |
All times are GMT
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|