So I’ve been looking into an OpenGL ES 2.0 rendering path for Openframeworks iOS, it lives here for now:
It doesn’t do any of the fancy stuff yet, it uses http://code.google.com/p/gles2-bc/ to emulate the fixed function pipeline.
Looking into this brings up a lot of areas where OF is tightly bound to OpenGL 1.1, basically making straight OpenGL calls, without notifying the renderer, this works for some ES 2.0 stuff, crashes on others.
Now of course OpenGL 1.1 is not going anywhere anytime too soon (well, let’s hope), but I do think it doesn’t hurt to be prepared, desktop OpenGL is on version 4.1 at the moment and the inability to mix OpenGL ES 1.1 and shaders is a pain.
The renderer is also the perfect place for ray tracer scene exporters for example(!!), like the Cairo renderer is doing now for vector graphics.
What I’ve been doing is wrapping the calls I need, say glLightfv into an equivalent _ofLightfv that passes the command along to the renderer.
My thinking here is that the commands should look the same as their OpenGL equivalents to make any code you are porting or found on the internet simple to move over, while making it clear that this is not stuff you should normally be calling yourself (hence the underscore), but I’d love to hear how people feel about this. There should of course be functions more clearly named with their purpose that allow us to do the same thing (e.g setLightParameters).
Nothing would be stopping your from writing straight OpenGL 1.1 code as long as you have an GL 1.1 context, but it just wouldn’t be passed along to the renderer, so in your own app you would only need to think about it if you knew you wanted ES 2.0 capability or wanted to use some custom renderer.
Now OpenGL has a LOT of functions, but I think it’s a question of 10% of them being used 80% of the time (I made this numbers up just now.) It would be a long term thing, but it’s a slow process that might be good to start before we really NEED to for whatever reason.
It does make any OpenGL code in the core look a bit odd, the naming is of course a small issue, but how do people fel about this approach in general?