在Mac OSX 10.9中,Glut deprecation,IDE:QT Creator [英] Glut deprecation in Mac OSX 10.9, IDE: QT Creator

查看:2155
本文介绍了在Mac OSX 10.9中,Glut deprecation,IDE:QT Creator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在qt creator上建立一个opengl程序,安装在我的mac上,使用osx 10.9。
我在osx10.9中得到了关于其deprecation的关于glut函数的几个警告,一个示例错误消息是:

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'已弃用: OS X 10.9 [-Wdeprecated-declarations]
glutInit(& argc,& argv);
^

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

我不知道GLUT.h是否在osx10.9中不再可用了?根据一些其他职位,据说只要我们将OS X部署目标更改回OSX10.8,那么它的工作原理。如何在qtcreator中这样做?谢谢!

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!

推荐答案

您仍然可以在10.9中使用它。他们给你发出了一个强烈的信号,希望你停下来,虽然......

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

您可以使用 -Wno -deprecated-declarations 编译器选项。

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

如果你试图使用GL3级别的功能,还有一些困难,需要包括 gl3.h ,而 glut.h 包括 gl.h ,这会导致在构建时可能发生冲突的其他投诉。我发现这个有点黑客的解决方法是通过定义标头防护包括 glut.h 包括 gl.h

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>

然后,对于使用GL3 +级别的功能,您需要指定一个额外的标志 glutInitDisplayMode()

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

glutInitDisplayMode(... | GLUT_3_2_CORE_PROFILE);

看起来可能是开始使用GLFW的时候了。我从来没有使用GLUT的任何严重的,但它总是非常方便的小演示/测试。

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.

这篇关于在Mac OSX 10.9中,Glut deprecation,IDE:QT Creator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆