简体   繁体   English

使用C ++的iPhone上的OpenGL ES?

[英]OpenGL ES on the iPhone with C++?

I'm trying to run some working C++ OpenGL code on the iPhone. 我正在尝试在iPhone上运行一些有效的C ++ OpenGL代码。 So far, I managed to run an Objective-C/OpenGL ES example on the iPhone, and some Objective-C->plain C++ file ("hello world" output to the console). 到目前为止,我设法在iPhone上运行了Objective-C / OpenGL ES示例,并运行了一些Objective-C->纯C ++文件(“ hello world”输出到控制台)。

But I can't any C++ OpenGL code. 但是我不能使用任何C ++ OpenGL代码。 The exact problem is including the OpenGL library in the C++ file: 确切的问题是在C ++文件中包含OpenGL库:

If I use the imports for Objective-C: 如果我将导入用于Objective-C:

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

it will say at all gl* calls "Use of undeclared identifier 'gl*'". 它会说gl *调用“使用未声明的标识符'gl *'”。

If I use the imports I use in only C++: 如果使用导入,则仅在C ++中使用:

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

It says OpenGL/OpenGL.h file not found (which I had expected, since OpenGL is full OpenGL library, not OpenGL ES). 它说找不到OpenGL / OpenGL.h文件(这是我期望的,因为OpenGL是完整的OpenGL库,而不是OpenGL ES)。

So how do I use this C++ file? 那么如何使用此C ++文件?

Already searched: 已搜索:

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

iPhone - OpenGL using C++ tutorial/snippet iPhone-使用C ++教程/摘录的OpenGL

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

But I don't find how to use the C++ file. 但是我找不到如何使用C ++文件。

尝试:-

#include <OpenGLES/AEGL.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM