glSwapBuffers 在哪里定义? [英] Where is glSwapBuffers defined?
问题描述
我需要在我的代码中使用 glSwapBuffers,但令我惊讶的是,这个方法不在头文件 GL/gl.h 中.我需要包含哪个头文件才能使用这种方法?不使用它不是一种选择,因为我为其他客户端提供了一个接口,这是文档化接口的一部分.
I need to use glSwapBuffers in my code, but to my surprise, this method is not in the header GL/gl.h . Which header file do I need to include to be able to use this method? Not using it is not an option since I am providing an interface for other clients and this is part of the documented interface.
推荐答案
没有函数glSwapBuffers",OpenGL 没有定义它.交换双缓冲窗口的前后缓冲区是底层图形系统提供的功能,即 Win32 GDI 或 X11 GLX.您正在寻找的函数是 wglSwapBuffers
和/或 glXSwapBuffers
.在 MacOS X 上,NSOpenGLViews 会自动交换.
There is no function "glSwapBuffers", OpenGL doesn't define it. Swapping the front and back buffer of a double buffered window is a function provided by the underlying graphics system, i.e. Win32 GDI, or X11 GLX. The function's you're looking for are wglSwapBuffers
and/or glXSwapBuffers
. On MacOS X NSOpenGLViews are automatically swapped.
然而,您很可能正在使用一些框架,如 GLUT、GLFW 或 Qt,它们为这些函数提供了一个可移植的包装器.阅读框架的文档.
However most likely you're using some framework, like GLUT, GLFW or Qt, which provide a portable wrapper around those functions. Read the framework's documentation.
这篇关于glSwapBuffers 在哪里定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!