I noticed some previous discussion about OpenGL ES, centred around Android and iOS. And yes, I saw the conclusions of those discussions: that the input methods normally available on those platforms are not suitable for a space fighter sim.
But what if I start talking about a proper Linux platform, where one can assume a proper sized screen and proper desktop input devices, yet where the graphics acceleration is provided by OpenGL ES (or ES2) instead of "classic" OpenGL? It's less powerful than today's desktop PCs, of course, but it compares very well to what was available at retail FS2's release.
I am of course talking about Raspberry Pi.
So I made sure that I could compile and run FSO with retail VPs on a more conventional Linux machine - which was surprisingly easy - an then started looking at what would be needed to convert it to GLES2.
Oh boy. The ancient and obsolete-in-GL-1.1-already glBegin/End paradigm is all over the place. Where did you guys learn your GL coding skills? Seriously.

So that's the first stage, and it can be done without breaking compatibility with anything whatsoever, and probably improving performance a bit while we're at it. I see that
vertex arrays are already used in some places, but since GLES has completely dropped the Begin/End paradigm (and for good reason), they have to be used *everywhere*. Yes, even for single points or fullscreen quads - those are the easiest to convert, in fact, and I already refreshed my skills on the MVE cutscene player (which has the virtue of being the very first thing on screen, so ridiculously easy to test). Ideally we should also be using VBOs where practical, but that's not a necessity.
I wonder if we can get rid of some of the unnecessary and inefficient fixed-point arithmetic while we're at it. This game never (intentionally, anyway) ran on anything less than a Pentium Classic, which had a pretty good FPU already.
The next stage, assuming the target is GLES2, is to
convert literally everything to shaders. GLES1 doesn't have shaders at all, which is a bit limiting, and all worthwhile hardware supports GLES2, so that's the obvious target. This is, however, the point where backwards compatibility with old desktop hardware (eg. original Radeon) that was perfectly capable of running retail FS2 starts to become a problem. Any thoughts on this would be interesting to hear. It should be possible to leave the fixed-functionality code in parallel, but then you have two code paths, one of which is likely to decay over time unless it is actively tested.
As part of converting everything to shaders, it's time to drop vertex arrays... what, didn't we just finish putting those in five minutes ago? Let me finish. Drop vertex arrays, normal arrays, colour arrays, texcoord arrays, all of them - and specify them as
vertex attribute arrays instead. Vertex attributes are the correct way to do a fully shaded graphics pipeline, which avoids having to shoehorn everything into and out of the original fixed-function pipeline state. You guessed it, as part of the major API cleanup, GLES2 dropped that state, so vertex attributes are all there is. This requires a minor rewrite of all the shaders, BTW, but there at least we don't have to worry about backwards compatibility - desktop GL2 has vertex attributes, and anything not supporting GL2 doesn't run GL shaders at all. Also fortunately, replacing vertex arrays et al with vertex attribute arrays is a like-for-like replacement job, so very easy.
All of the above can be done on desktop GL on any already-supported platform. All of it is a good refactoring and cleanup operation *anyway*. Some of it might directly result in performance improvements due to coming up to date and being cleaner.
Once all of that is done, it should be reasonably straightforward to do the actual port to GLES2. It mostly involves hunting down uses of missing features and sorting out quirks (such as precision specifiers) of the smaller API. It also means arranging for a new context creation and possibly input method, which might involve work on SDL rather than FSO itself.
All in favour?

All against?
