我正在将几百行iOS代码移植到使用OpenGLES
的Mac,特别是EAGLContext
和CAEAGLLayer
。
到目前为止,我已将OpenGLES.framework
更改为OpenGL.framework
并添加了:
#if TARGET_OS_IPHONE
#import <OpenGLES/EAGL.h>
#import <OpenGLES/EAGLDrawable.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#else
#import <OpenGL/OpenGL.h>
#endif
#if TARGET_OS_IPHONE
#define MYOpenGLContext EAGLContext
#define MYOpenGLLayer CAEAGLLayer
#else
#define MYOpenGLContext NSOpenGLContext
#define MYOpenGLLayer CAOpenGLLayer
#endif
然后分别将所有EAGLContext
和CAEAGLLayer
更改为MYOpenGLContext
和MYOpenGLLayer
。
这还不够,因为glOrthof
和glBindFramebufferOES
,glGenRenderbuffersOES
等功能无法识别。我应该用什么来取代它们?