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.
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.
OpenGLES is deprecated and is not available when building for Mac Catalyst.
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).
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.
Try:-
#include <OpenGLES/AEGL.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With