5

我正在尝试在 iPhone 上运行一些有效的 C++ OpenGL 代码。到目前为止,我设法在 iPhone 上运行了一个 Objective-C/OpenGL ES 示例,以及一些 Objective-C->plain C++ 文件(“hello world”输出到控制台)。

但我不能使用任何 C++ OpenGL 代码。确切的问题是在 C++ 文件中包含 OpenGL 库:

如果我使用 Objective-C 的导入:

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>

它会说所有 gl* 调用“使用未声明的标识符 'gl*'”。

如果我使用仅在 C++ 中使用的导入:

#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>

它说未找到 OpenGL/OpenGL.h 文件(这是我所预料的,因为 OpenGL 是完整的 OpenGL 库,而不是 OpenGL ES)。

那么如何使用这个 C++ 文件呢?

已经搜索:

http://www.hackint0sh.org/iphone-developer-exchange-9/iphone-sdk-can-i-use-c-opengl-38638.htm

iPhone - OpenGL 使用 C++ 教程/片段

https://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithEAGLContexts/WorkingwithEAGLContexts.html#//apple_ref/doc/uid/TP40008793-CH103-SW1

但我没有找到如何使用 C++ 文件。

4

1 回答 1

7

尝试:-

#include <OpenGLES/AEGL.h>
于 2012-09-02T22:54:24.873 回答