Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

666_1337

tripple buffering

This topic is 5448 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

hi i know what double (frame-)buffering is, but i can''t image what tripple buffering is supposed to be... someone knows? is it just one more buffer so you have always one untouched buffer (one beeing drawn and one beeing computed)? if so what does that serve?

Share this post


Link to post
Share on other sites
Advertisement
Triple buffering allows the card to render things slightly behind what the processor is doing. That is, your game could be on one frame but your video card is still busy rendering the last frame. This can sometimes speed things up quite a bit, but it also uses more memory.

Share this post


Link to post
Share on other sites
Wouldnt this also introduce some visual lag between the players actions and what he sees at lowish framerates? Or is 2 frames late even noticeable?

Waramp.

"Before you insult a man, walk a mile in his shoes.
That way, when you do insult him, you''ll be a mile away, and you''ll have his shoes."

Share this post


Link to post
Share on other sites
It''s not really a noticeable lag. It can make motion smoother when your engine tends to have a few individual frames that take significantly longer to render than most, simply because you have another cached frame you can ''use up'' before the screen freezes.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
To answer your question:

Triple buffering will speed up rendering for the situation where your frame rate is slower than the monitor refresh rate and you only flip pages during vblank.

Here is an example of the problem:

Suppose the refresh rate is 100 Hz (or 10 ms/refresh) and it takes 11 ms to render the frame. Since you can only do a page flip during vblank, you flip every 20 ms (every other frame). That means that after you are done drawing, you have to wait 9 ms for the new draw buffer to become available.

With triple-buffering, you start drawing immediately into a third buffer, instead of waiting for the second buffer.

Here is a comparison using the above example. The buffers are A, B, and C.
Time(ms) Double-buffering                  Triple-buffering
-------- ---------------- ----------------
0 draw A 10ms draw A 10ms
10 draw A 1ms, wait 9ms, display A draw A 1ms, draw B 9ms, display A
20 draw B 10ms draw B 2ms, draw C 8ms, display B
30 draw B 1ms, wait 9ms, display B draw C 3ms, draw A 7ms, display C
40 draw A 10ms draw A 4ms, draw B 6ms, display A
50 draw A 1ms, wait 9ms, display A draw B 5ms, draw C 5ms, display B
60 draw B 10ms draw C 6ms, draw A 4ms, display C
70 draw B 1ms, wait 9ms, display B draw A 7ms, draw B 3ms, display A
80 draw A 10ms draw B 8ms, draw C 2ms, display B
90 draw A 1ms, wait 9ms, display A draw C 9ms, draw A 1ms, display C
100 draw B 10ms draw A 10ms, display A

As you can see, the double-buffered frame rate is 50 fps (5.5 frames in 110 ms) and the triple-buffered frame rate is 91 fps (10 frames in 110 ms). The benefit of triple-buffering depends on how long it takes to render a frame and how much time is wasted waiting for vblank.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
it''s gonna come with sdl 1.3

Share this post


Link to post
Share on other sites
Thanks for the tip, but i''m not interested for SDL! (If the post was for me AP!!!).

I want to know if it is availiable to custom OpenGL applications.

HellRaiZer

Share this post


Link to post
Share on other sites
AP: SDL has nothing to do with triple buffer support for OpenGL, that is entirely an os/driver issue. I suggest reading the system API docs for whatever platform you are using for how to set up triple buffering if available.

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
simple said, it makes rendering as fast as possible possible, just like when you disable vsync. but at the same time, you can still have vsync.

so no tearing, and fullspeed rendering. and full time 100% gpu and cpu usage.

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!