Working on migrating AE to OpenGL ES 2.0

Now that I have a break from other duties, I’ve been working on improving AE for iOS.  One of my early design decisions I made in AE is to go with OpenGL ES 1.1.  At the time, my only iOS device did not support OpenGL 2.0, so for practicality sake, 1.1 made sense.  Furthermore, I needed some basic functionality that was stripped from OpenGL ES 2.0.  ES 2.0 was clearly unattractive… at the time…

Today, the story is different.  All of my “supported” iOS devices support OpenGL ES 2.0 and in some cases 3.0.  Yes, they still support 1.1, and it’s arguable that the practical decision is to remain on 1.1.  However, it’s only practical if I don’t add new features that call on the graphics card.  I’m also considering the path to porting the application to other platforms, such as Android and Desktops.  From this perspective, ES 1.1 looks increasingly problematic.

The kicker that’s forcing the transition is the time scale control on the bottom of the screen.  It turns out that feature is quite a difficult to display.  The time scale tends to be a memory hog and requires a great deal of code to provide full functionality.  I’ve long known that the control should be moved to OpenGL rather than using higher-level functions.  Originally, the time scale was created using simple bezier-path draw calls. In the last version, I moved the system to Apple’s layers.  That transition was meant to make the code easier to maintain.  However, it turned out, on older devices in particular, the app became crash prone because the layers took up an unexpected amount of memory.  I managed to work through this problem for a stable release, but I wasn’t happy with the situation.

Enter OpenGL ES 2.0.  Now, the time scale is not done by any means, so these comments are initial impressions.  Now that I’ve worked with it, I do regret not going with ES 2.0 from the beginning (it still wouldn’t have been possible to release the original app with ES 2.0 support since I had no hardware at the time).  ES 2.0 is clearly superior to ES 1.1.  Surprisingly, I found that while in some areas ES 2.0 requires more code, the transition from layers to ES 2.0 appears, at least in some areas, is thinning out my code.  That’s exciting!  Since the code for the layers was extremely complex, it’s hard to improve or add features.  With the code simplifying, I feel I can consider, at least, adding functionality I wouldn’t have been too keen on adding before.

Now, back to work on the code.  We’ll see how this turns out…