GLUT on OS X with OpenGL 3.2 Core Profile
Asked Answered
C

3

9

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?

Ceiling answered 29/6, 2012 at 9:31 Comment(0)
L
19

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
        );
Lento answered 6/12, 2012 at 19:30 Comment(4)
Hi there. I have os X Mavericks and this solution still doesn't work. Could you please help me on this ? here is my code gist.github.com/dhirajbodicherla/11238004Headline
awesome, thanks... lots of misinformation about GLUT out there, was almost convinced i had to stay in 2.1 land...Birch
Both GLUT and FreeGLUT seem to trigger errors when configuring them for the Core profile. At this moment in time you will need to use a different windowing library to use the Core profile on OSX.Leyba
^^^ I'm today using GLUT on OSX. Can do GLUT_3_2_CORE_PROFILE, and update the shaders to use in and out like they should, and no errors. But no drawing either... suspect some subtlety about OpenGL 3.2 and where does fragcolor now go?Volvulus
A
1

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.

Appose answered 29/6, 2012 at 9:49 Comment(4)
But does FreeGLUT supports OpenGL 3.2 on OS/X? I was unable to find any details about this.Ceiling
Actually, I don't know. I thought it did, but I have to admit that there's no hint in the API documentation (which is btw pretty incomplete) that it does. I personally use GLFW, which certainly does support OpenGL 3.2.Appose
I also recommend GLFW for 3.2 on OS/X. It is the only lib that worked for me. SDL 2 claims compatibility but I ran into all sorts of issues on OS/X.Majewski
Thanks for the advice. But what I really want to know is if there is a GLUT library available in some form. Libraries with significant different API than GLUT offers is currently of no interest to me.Ceiling
D
0

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.

Diatropism answered 6/2, 2015 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.