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?

Slipp D. Thompson
  • 33,165
  • 3
  • 43
  • 43
Mortennobel
  • 3,383
  • 4
  • 29
  • 46

3 Answers3

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
        );
Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
  • 1
    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 https://gist.github.com/dhirajbodicherla/11238004 – Dhiraj Apr 24 '14 at 03:58
  • 1
    awesome, thanks... lots of misinformation about GLUT out there, was almost convinced i had to stay in 2.1 land... –  Jun 01 '14 at 00:05
  • 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. – Rebs Sep 03 '14 at 01:43
  • 1
    ^^^ 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? – david van brink Sep 06 '14 at 21:22
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.

flyx
  • 35,506
  • 7
  • 89
  • 126
  • But does FreeGLUT supports OpenGL 3.2 on OS/X? I was unable to find any details about this. – Mortennobel Jun 29 '12 at 10:03
  • 1
    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. – flyx Jun 29 '12 at 14:10
  • 3
    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. – Stephan van den Heuvel Jul 03 '12 at 15:37
  • 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. – Mortennobel Jul 04 '12 at 19:52
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.