Does any one knows what is meant by triple
buffer and The Difference Between it and
double Buffer and
How it Can be implmented in OpenGL ?
Thanks For all of you ?
Does any one knows what is meant by triple
buffer and The Difference Between it and
double Buffer and
How it Can be implmented in OpenGL ?
Thanks For all of you ?
In double buffering, you have a front and a back buffer, and swap between the two (or copy from the back to the front). This is a standard OpenGL feature.
In triple buffering, you have a front and two back buffers. Letâs call the initial front buffer âAâ, the first back buffer âBâ, and the second back buffer (if present) âCâ.
When double buffering, you are displaying A and drawing to B. When thatâs done, you issue a swap (to display B). It may take some time for the swap to happen (for CRTs, it usually happens on vertical retrace to avoid tearing). Until the swap completes, you canât switch your drawing back to A, since itâs still being displayed. So youâre temporarily stuck. As a practical example, letâs say your app could run at 45 frames per second and the monitor refreshes at 60. This means that each frame takes 1.5 refreshes to draw. If your swaps wait for vertical retrace, you have 0.5 refreshes worth of dead time after each frame. And your app will run at 30 frames per second.
When triple buffering, you can draw to C while waiting for the vertical retrace and will end up getting closer to 45 fps. Effectively, some frames will be displayed for 2 refreshes, while others will be displayed for 1.
If your app runs faster than the monitor refresh, triple buffering doesnât help much since youâll eventually get two refreshes behind and end up waiting.
This isnât much of an issue for benchmarking, since waiting on vblank is usually disabled. In this case, swaps are nearly instantaneous. If you leave vblank on when benchmarking, it would be impossible to distinguish between a system that could run at 59 fps and one that could run at 31 fps in the example above â both would run at 30 fps even though the first one was nearly twice as fast!
not that i want to implement it but
this question often comes up
âhow to do triple buffer in openglâ
the stock answer is
âits up to the driverâ
which is a bit unsatisfactory,
we can use wglSwapInterval (or something like that to swap at the vrefresh)
so how to do triple buffering in opengl. the stock answer sounds like a lottery.
It is a lottery. Itâs really a shame.
It could have been worked into the ARB_pixel_format extension easily but the ARB didnât seem to consider this.
Iâd prefer a somewhat clunky WGL_ARB_pixel_format kind of way to control it over no way to control it every day, obviously.
http://www.opengl.org/discussion_boards/ubb/Forum7/HTML/000307.html
[This message has been edited by zeckensack (edited 10-02-2002).]
Iâm not sure you can REALLY support triple buffering at all in OpenGL with the current definition of GL_FRONT and GL_BACK render targets.
However, I would be okay with a pixel format flag (or separate extension) which let me enable triple buffering, and which restricted what I could do with the GL_FRONT buffer, and which made the GL_BACK buffer go undefined after SwapBuffers even when youâre in SWAP_COPY mode (I forget whether this is already the case or not).
My GL implementation (ATI Radeon 8500) defaults to triple buffering* when I cover the whole screen with my OpenL window.
And it defaults to double buffering* when I use âwindowedâ display.
They already do that. All thatâs missing is a way to control it.
*You can easily measure that yourself if you clear/flip/clear/flip/clear/flip a few times with different colors and then only flip/sleep/flip/sleep. Count the different colors you end up with.