T2D GFX: Filters!
by Paul Jan · 06/25/2013 (2:16 am) · 3 comments
One of the features of iOS and OSX is the ability to apply Filters - premade shaders - to textures. Here I start to add these filters to the iOS build.

This is the CIPixellate filter applied to the truck body and tires, set up as a taml file as follows.
<FilterImageAsset
AssetName="F_truck"
Image="@asset=TruckToy:truckBody"
Filter="CIPixellate" />
I'm not sure if this will be the final format since one of the major uses would be filtering the full screen render or on a layer-by-layer basis.
For some strange reason this build is crashing half of the time in iOS, in a function "glrGetPrivateInteger". The one fix I've seen so far doesn't seem to do me any good.

This is the CIPixellate filter applied to the truck body and tires, set up as a taml file as follows.
<FilterImageAsset
AssetName="F_truck"
Image="@asset=TruckToy:truckBody"
Filter="CIPixellate" />
I'm not sure if this will be the final format since one of the major uses would be filtering the full screen render or on a layer-by-layer basis.
For some strange reason this build is crashing half of the time in iOS, in a function "glrGetPrivateInteger". The one fix I've seen so far doesn't seem to do me any good.
About the author
#2
Basically how it works:
1) make CIImages from input GL textures
2) instance CIFilter, set properties
3) set up GL Framebuffer Object, attach output GL texture
4) draw the filter using CIContext (built from the opengl context) drawImage: inRect: fromRect
A pure OpenGL implementation would be to write shaders that duplicate the CIFilters and perform the same 1-4 steps.
One thing that I haven't gotten in yet is that CIFilters are supposed to stack, and get additional optimization along the way.
One oddball thing: I get intermittent crashes in XCode, but none so far in Appcode.
06/26/2013 (7:25 pm)
Someone could do an equivalent by making their own shaders, since the work involved isn't all that different. Apple just makes a big deal about how their implementation is more efficient and easier to do. Basically how it works:
1) make CIImages from input GL textures
2) instance CIFilter, set properties
3) set up GL Framebuffer Object, attach output GL texture
4) draw the filter using CIContext (built from the opengl context) drawImage: inRect: fromRect
A pure OpenGL implementation would be to write shaders that duplicate the CIFilters and perform the same 1-4 steps.
One thing that I haven't gotten in yet is that CIFilters are supposed to stack, and get additional optimization along the way.
One oddball thing: I get intermittent crashes in XCode, but none so far in Appcode.
#3
Even if there isn't quite a Windows equivalent, having filters on OS X and iOS would be great.
06/27/2013 (6:22 am)
Quote:One oddball thing: I get intermittent crashes in XCode, but none so far in Appcode.That is indeed odd, though I'm not surprised Appcode is handling your work better than Xcode. What version of Xcode and Appcode are you using?
Even if there isn't quite a Windows equivalent, having filters on OS X and iOS would be great.

Employee Michael Perry
ZombieShortbus