OpenGL: How to control which buffering method my window will use?

六月ゝ 毕业季﹏ 提交于 2019-12-13 02:12:35

问题


I want to give the user ability to choose from double buffering and triple buffering, because on some cards (or OS?) the triple buffering is enabled by default, and its causing some performance problems.

How can i do this?


回答1:


You cannot do this from OpenGL itself, since OpenGL only deals with drawing calls, etc. You need to use the vendor specific calls for this. In Windows, there is the WGL for handling context creation, etc.




回答2:


There are no such function in OpenGL.

The closest what I found is glutInitDisplayMode, where you can pass GLUT_DOUBLE or GLUT_SINGLE to enable or disable double buffering. Other window managers, like for example SDL have other call :

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);


来源:https://stackoverflow.com/questions/4827570/opengl-how-to-control-which-buffering-method-my-window-will-use

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