Search code examples
iosobjective-copengl-escocos2d-iphoneopengl-es-2.0

Change OpenGL ES version on iOS


My OpenGL calls are behaving a bit strange on iPhone 5S and iPad Air. I don't know why, but maybe it is due to the fact that they support OpenGL ES 3, whereas previous devices do not. So I guess it is using OpenGL ES 3 and that may be the problem.

I don't know much about it. Is there a way force my app to use OpenGL ES 2?


Solution

  • You specify the API version when you create the OpenGL context. For ES 2.0, the call to create the context looks like this:

    EAGLContext* pCtx = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
    

    For ES 3.0, the context creation looks like this:

    EAGLContext* pCtx = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES3];