Glut deprecation in Mac OSX 10.9, IDE: QT Creator

22,187

You can still use it in 10.9. They're sending you a pretty strong signal that they want you to stop, though...

You can disable those warnings with the -Wno-deprecated-declarations compiler option.

There's also some difficulties including the right headers if you're trying to use GL3 level features, because you need to include gl3.h for that, while glut.h includes gl.h, which causes additional complaints about possible conflicts while building. The somewhat hacky workaround I found for this is to prevent glut.h from including gl.h by defining the header guard:

#include <OpenGL/gl3.h>
#define __gl_h_
#include <GLUT/glut.h>

Then, for using GL3+ level features, you need to specify that with an additional flag to glutInitDisplayMode():

glutInitDisplayMode(... | GLUT_3_2_CORE_PROFILE);

It looks like it's probably time to start using GLFW. I never used GLUT for anything serious, but it was always very convenient for small demos/tests.

Share:
22,187
Clueless Gorilla
Author by

Clueless Gorilla

Updated on June 08, 2020

Comments

  • Clueless Gorilla
    Clueless Gorilla about 4 years

    I was trying to build an opengl program on qt creator, installed on my mac, with osx 10.9. I got several warnings on glut functions about its deprecation in osx10.9, a sample error message is like:

    'glutInit' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations] glutInit(&argc, &argv); ^

    I wonder if GLUT.h is not usable anymore in osx10.9? According to some other posts, it is said that as long as we change "OS X Deployment Target" back to OSX10.8, then it works. How to do so in qtcreator? Thank you!

  • Reto Koradi
    Reto Koradi about 10 years
    @AndonM.Coleman: It's there in the standard GLUT that ships with Xcode. Just go check if you don't believe it. It's on line 186 of glut.h in both the MacOSX10.8.sdk and MacOSX10.9.sdk that ships with Xcode 5.1.
  • Andon M. Coleman
    Andon M. Coleman about 10 years
    Yeah, you are right, sorry. I did look but the OS X machine I have in front of me right now runs 10.6, so it is not surprising that constant does not exist now that I think about it :P I was mixing up that constant with glutInitContextVersion (...) (FreeGLUT's solution).