GLUT on OS X with OpenGL 3.2 Core Profile

2019-01-09 07:45发布

Is it possible to use GLUT on OS X Lion or OS X Mountain Lion using core profile (so I can use GLSL 1.50)?

Can I use the built in GLUT or do I need to use a third-part library such as FreeGLUT?

And is there any simple 'Hello world' applications available for OS X with either an XCode project or a make-file?

3条回答
\"骚年 ilove
2楼-- · 2019-01-09 07:56

You need at least Mac OS X Lion (OS X 10.7 or higher) for the basic support of OpenGL 3.2. To use the OpenGL 3.2 Core Profile, just add

glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | ... | ...);

in your main-function. You can check it by

std::printf("%s\n%s\n", 
        glGetString(GL_RENDERER),  // e.g. Intel HD Graphics 3000 OpenGL Engine
        glGetString(GL_VERSION)    // e.g. 3.2 INTEL-8.0.61
        );
查看更多
Evening l夕情丶
3楼-- · 2019-01-09 08:14

flyx is wrong, OpenGL 3.2 is the version that added core and compatibility profiles (not 3.3). However, Apple just doesn't support compatibility profiles at all (no reason, they just don't). GLUT comes in xcode as a framework and you can use it that way. So you can do it in a completely non-standard, platform specific way.

查看更多
Fickle 薄情
4楼-- · 2019-01-09 08:19

GLUT does not support OpenGL 3.2, as it provides no functionality to specify the desired OpenGL context version. Also, GLUT's functionality relies on APIs that are not available with the OpenGL 3.2 Core Profile.

You have to switch to FreeGLUT or GLFW.

查看更多
登录 后发表回答