将OpenGLES代码从iOS移植到Mac

时间:2013-03-14 16:19:53

标签: ios macos opengl opengl-es

我正在将几百行iOS代码移植到使用OpenGLES的Mac,特别是EAGLContextCAEAGLLayer

到目前为止,我已将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

然后分别将所有EAGLContextCAEAGLLayer更改为MYOpenGLContextMYOpenGLLayer

这还不够,因为glOrthofglBindFramebufferOESglGenRenderbuffersOES等功能无法识别。我应该用什么来取代它们?

0 个答案:

没有答案