Search code examples
iosopengl-esclippingopengl-es-1.1

OpenGL ES 1.1 on iOS: No clipping planes?


I have an earnest desire to use clipping planes, and I am currently using OpenGL ES 1.1. In theory I could upgrade to GL ES 2 or 3, I'd simply have to learn a bit more e.g. about shaders. But is there a way to do clipping planes in GL ES 1.1?

UPDATE: iOS has 6 planes available.


Solution

  • According to the spec OpenGLES 1.1 supports clip planes. You can get the number of supported clip planes with glGetIntegerv(GL_MAX_CLIP_PLANES, &iNumClipPlanes). The spec mandates at least 1 clip plane, which may not be sufficient for your needs.

    If you're iOS specific, then this page shows that all the old iOS devices have 6 GL_MAX_CLIP_PLANES on OpenGLES 1.1, and I'd be surprised if the newer ones have less.

    Alternatively, there are interesting ways to warp your view frustum to get a single clip plane which might help depending on your situation - particularly useful for reflections:

    http://hacksoflife.blogspot.co.uk/2008/12/every-now-and-then-i-come-across.html

    http://www.terathon.com/code/oblique.html