且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Mac OSX 10.8.4上带有GLFW3的现代OpenGL-缺少glGenVertexArrays()和glBindVertexArray()吗?

更新时间:2023-11-10 16:55:52

您需要在OS X上包含<OpenGL/gl3.h>才能使用OpenGL 3.2核心API调用.请注意,如果同时包含<OpenGL/gl.h><OpenGL/gl3.h>,则可能会收到编译器警告,这是因为gl3.h具有两个目的:

You need to include <OpenGL/gl3.h> on OS X in order to use OpenGL 3.2 core API calls. Be aware that if you include both <OpenGL/gl.h> and <OpenGL/gl3.h> you may receive a compiler warning, this is because gl3.h serves two purposes:

  1. 提供核心OpenGL 3.2的功能,枚举和类型定义
  2. 消除在核心OpenGL 3.2中无效的不推荐使用的函数,枚举和类型定义


它们实际上是互斥的,正确的标头取决于您使用的上下文版本:


They are effectively mutually exclusive, the proper header depends on the context version you are using:

  • MacOS X 10.7 + :( OpenGL: 2.1 )

    • #include <OpenGL/gl.h>


    • MacOS X 10.7+: (OpenGL: 2.1)

      • #include <OpenGL/gl.h>


      • #include <OpenGL/gl3.h>