OpenGL buffers,glFlush and glutSwapBuffers()

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 12:33:56

问题


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 ?


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!