Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get supported OpenGL ES versions available on any given iOS device at runtime?

I am looking for a way to get a list of supported OpenGL ES versions OR max OpenGL ES version available on a iOS device at runtime ?

Ideally the solution MUST not:

  • not check for the particular device model

PS: Project settings: Base SDK = Latest iOS (7.0) Deployment Target: 4.3

like image 423
David Andreoletti Avatar asked Jan 26 '26 17:01

David Andreoletti


1 Answers

The preferred way to do this is to try to create contexts for the various OpenGL ES versions and fall back to older ones if they fail. For example, you could check for OpenGL ES 3 support using:

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

if aContext is nil, that device doesn't support OpenGL ES 3.0. You can then fall back to

    aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

to test for 2.0 support. If that fails (aContext is nil again), then the device only supports OpenGL ES 1.1. This doesn't require you to check device types (and it accounts for future, unreleased devices).

like image 164
Brad Larson Avatar answered Jan 29 '26 07:01

Brad Larson