When you request your pixel format using one of the lower-level APIs on OS X, you need to add the following to your attribute list in order to use a core profile:
CGL:
kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core
NSOpenGL:
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core
Now, while the particular constant is named ...3_2Core
, what it actually means is request a context that removes all deprecated features and supports at least OpenGL 3.2 (a core profile, in other words). You can get a 4.1 or 3.3 context using this same constant; in all honesty, including an actual version number in the constant was probably a poor choice.
If you do not specify this when you request your pixel format, OS X will give you kCGLOGLPVersion_Legacy
or NSOpenGLProfileVersionLegacy
respectively. And this will limit you to OpenGL 2.1 functionality.
If you are using a higher-level framework, then you will need to consult your API reference. However, be aware that on OS X you must have a core profile context to access anything newer than OpenGL 2.1.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…