Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL ES on the iPhone with C++?

Tags:

c++

ios

opengl-es

I'm trying to run some working C++ OpenGL code on the iPhone. 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).

But I can't any C++ OpenGL code. The exact problem is including the OpenGL library in the C++ file:

If I use the imports for Objective-C:

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

it will say at all gl* calls "Use of undeclared identifier 'gl*'".

If I use the imports I use in only 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).

So how do I use this C++ file?

Already searched:

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

iPhone - OpenGL using C++ tutorial/snippet

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.

like image 895
User Avatar asked Sep 02 '12 22:09

User


People also ask

Can you use OpenGL on Iphone?

iOS implements standard OpenGL ES framebuffer objects, which you can use for rendering to an offscreen buffer or to a texture for use elsewhere in an OpenGL ES scene.

Is OpenGL deprecated on iOS?

OpenGLES is deprecated and is not available when building for Mac Catalyst.

Is OpenGL ES the same as OpenGL?

The main difference between the two is that OpenGL ES is made for embedded systems like smartphones, while OpenGL is the one on desktops. On the coding level, OpenGL ES does not support fixed-function functions like glBegin/glEnd etc... OpenGL can support fixed-function pipeline (using a compatibility profile).

Why did Apple get rid of OpenGL?

Apple is most definitely deprecating OpenGL to favor its low-level Metal graphics API for general market and gaming market reasons—skewed most obviously in the iOS direction.


1 Answers

Try:-

#include <OpenGLES/AEGL.h>
like image 181
Max Avatar answered Oct 13 '22 19:10

Max