Hot answers tagged double-buffering
Fundamentally, a core goal in rendering is for each frame displayed on the monitor to present a single, coherent image. There are several different strategies which are, or were, used in order to achieve this. In the following, I mention "vsync". Vsync is the moment at which the monitor begins drawing a new screen image; it's the point at which "vblank" ...
Any drawing API function called from the CPU will be submitted to the GPU command ring buffer to be executed later by the GPU. This means that OpenGL functions are mostly non-blocking functions. So the CPU and the GPU will be working in parallel. The most important thing to note is that your application can be CPU or GPU bound. once you call glFinish the ...
OpenGL sometimes defers your commands until later -- when you see a 0 ms runtime for a particular GL operation, it doesn't mean that operation took 0 ms, it just means that function call (which may have simply queued an operation, not did an actual GPU operation) took a small amount of time. See glFlush(). So, it depends on what work is being done where. ...
OpenGL never updates the screen, technically. There is a window system API that is separate from GL (e.g. GLX, WGL, CGL, EGL) that does this. Buffer swaps using these APIs generally implicitly invoke glFlush (...) but in some implementations (e.g. the GDI rasterizer on Windows) it does a full glFinish (...): *On the left ...
I assume you're familiar with this experiment? Essentially John Carmack was doing something similar, recording the screen and timing pixels sent to the screen. He found that a good deal of the latency came from the screen. Other factors were the input delay from the keyboard, video drivers and or course the execution of the program itself.
Take a look at BufferStrategy, it's the preferred way to use multibuffering for java 2d, - and it works like a charm. Searching google for examples on how to use it should be straightforward :)
Only top voted, non community-wiki answers of a minimum length are eligible