Martin Perry Martin Perry - 5 months ago 47
iOS Question

OpenGL ES 2 and 3 on iOS

I have built my iOS app using OpenGLES 3. Now I want it to support older devices with OpenGLES 2. I have inited context as ES 2 and all is working. However, my app is using ES 3 headers, so some functions are present in them.

For example:

ES 3 -> glBindVertexArray
ES 2 -> glBindVertexArrayOES

Is it safe to keep ES 3 headers and call ES 3 function on ES 2 only device (if this device supports OES extension). If not, how to solve this problem? I cannot do something like

if (version == 2) glBindVertexArrayOES(0)
else glBindVertexArray(0)

because glBindVertexArrayOES is not in ES 3 headers and glBindVertexArray is no in ES 2 and I dont know ES version in build-time, only at runtime.

Answer Source

I have tested that by building app against OpenGLES 3 headers and using


is working even if the context is set to ES 2 on older devices.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download