glut库缺少glutInitContextVersion() [英] glutInitContextVersion() is missing from glut library

查看:422
本文介绍了glut库缺少glutInitContextVersion()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在练习一些opengl代码,但是当我想通过 glutInitContextVersion()强制opengl上下文使用特定版本的opengl时,它编译过程失败并给出以下消息:-

I am practicing some opengl code, how ever when i want to force the opengl context to use a certain version of opengl through glutInitContextVersion() it fails compilation process and gives this message:-

使用未声明的标识符'glutInitContextVersion'

use of undeclared identifier 'glutInitContextVersion'

我想解决此问题,因此我将代码保持尽可能简单

i want to fix this issue so i kept my code as simple as possible

代码

#include "File.h"
#include <GLUT/GLUT.h>
#include <OpenGL/OpenGL.h>

using namespace std;

int  main ()
{

    glutInitContextVersion(3,2);

    return 1;
}

但是我能够使用其他过剩功能而没有任何错误或警告消息

However i was able to use other glut functions without any error or warning messages

我正在OS X 10.9.1的Macbook air上运行Xcode 4.4.1

I am running Xcode 4.4.1 on Macbook air with OS X 10.9.1

推荐答案

GLUT开发在 许多 年前就结束了,这实际上是一个非标准扩展(在FreeGLUT中添加) ). OS X附带了自己的标准GLUT(3.x)实现.尽管自从您在问题中提到OS X 10.9以来,值得指出的是,如果尝试使用编译器,它将生成各种烦人的弃用警告.

GLUT development ended many years ago and that is actually a non-standard extension (added in FreeGLUT). OS X ships with its own implementation of standard GLUT (3.x). Though since you mention OS X 10.9 in your question, it is worth pointing out that the compiler is going to generate all sorts of annoying deprecation warnings if you try to use it.

如果要使用附带的框架在OS X上获得3.2核心上下文,则必须使用CGL(C)或NSOpenGL(Objective C).

If you want to get a 3.2 core context on OS X using the Frameworks that ship with it, you will have to use CGL (C) or NSOpenGL (Objective C).

如果您坚持使用GLUT,则需要找到FreeGLUT for OS X的端口,而不是平台随附的Framework.当然,这意味着要跟踪其他依赖项,但是我认为这没什么大不了的.只需记住停止包含Xcode附带的GLUT标头即可.

If you insist on using GLUT, you will need to find a port of FreeGLUT for OS X instead of the Framework that ships with the platform. This of course means tracking down additional dependencies, but I don't think that will be that big a deal. Just remember to stop including the GLUT headers that ship with Xcode.

这篇关于glut库缺少glutInitContextVersion()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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