I've never been much of a GPU guy but with the new GPU supercharged Mac Pros coming out this fall I'm finding myself needing to become one fairly quickly. This means it's time for me to get serious about making Acorn take advantage of the GPU as much as it can, and that means learning a bit of OpenGL.
Apple has some sample code named CMicroPaint which uses an OpenGL view to render a CIImage. It's interesting code and I keep on coming back to it- but it's missing a scrollview and every time I try to add one I end up getting frustrated by how broken everything is after that. Again, I'm not a GL guy.
So over the past couple of days I've taken the sample code and hacked it up quite a bit, getting a better understanding of what exactly is going on and playing with a number of different techniques to adding a scrollview into the mix.
I didn't stop with the scrollview though. Another requirement of Acorn is to be able to draw a HUD over the canvas for the filters, so I made a class which wraps an IOSurface up with a CGContextRef, and which is then composited over the base image (which also has a CIFilter applied to it). I'm not sure there's any real speed advantage to using an IOSurface or not - but I wanted an excuse to use IOSurface for something.
I've bundled it all up and put it on GitHub: FMMicroPaintPlus is not the prettiest code and I still consider myself a GL newb - but it all works and meets my requirements nicely. So if you need to render Core Image graphics on the GPU with a scrollview and HUD in the mix; make sure to check out FMMicroPaintPlus. (And of course I need to credit Apple for creating the original code in the first place- danke!)