Is there any difference between using, glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
with
glFlush()
and glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
with glutSwapBuffers()
?
By difference, I imply difference in the execution or display of code ?
There is a huge difference on modern platforms, in the sense that compositing window mangers (e.g. Aero on Windows Vista+) effectively own the front-buffer. If you draw single buffered, a buffer swap never occurs, and the end result is that nothing will ever be displayed on the screen.
This also affects some implementations of hybrid GPUs (e.g. Intel integrated + NVIDIA discrete on laptops) even without a compositing window manager. On such a system, the buffer swap operation is what copies the discrete GPU's framebuffer to the integrated for final output.
There is almost no reason to use single-buffered rendering on modern GPUs. It used to be that having to maintain two color buffers ate a lot of memory, which was also a compelling argument against triple-buffering, but these days the amount of memory required for the color buffer is a minute fraction of VRAM.
来源:https://stackoverflow.com/questions/25949228/opengl-buffers-glflush-and-glutswapbuffers