<< September 2012 | Home | November 2012 >>

Quick Tip: Working with CGBitmapContext and pixel ordering (RGBA, BGRA etc)

This isn't immediately obvious from the Apple documentation. Hopefully this is more clear.

If you are working with RGBA images you use kCGBitmapByteOrder32Big combined with kCGImageAlphaLast or kCGImageAlphaPremultipliedLast or kCGImageAlphaNoneSkipLast.

If you are working with BGRA images you use kCGBitmapByteOrder32Little combined with kCGImageAlphaFirst or kCGImageAlphaPremultipliedFirst or kCGImageAlphaNoneSkipFirst.

FIX: Problem finding WX (widgets) dependency running Steam ContentPrep.app while performing OSX Builds

As part of the procedure for making Steam builds targeted for OSX, you need to preprocess the title's .app directory with the ContentPrep tool before moving the whole lot to a Windows machine to make the final build. Typically very straight forward, we had some difficulties getting it working for us.

Having started development on the OSX port of Cortex Command back in 2008, we had locked the versions down of the libraries and dependencies for title pretty early in the piece. This was good and bad. Being so short of manpower we have saved an in-ordinate amount of time of the years by now having to track the latest versions of dependencies. Occasionally we made exceptions for particularly valuable upgrades, but for the most part the dependencies and build systems are the same as they were years ago.

One of the downsides of having locked everything down so long ago is occasional incompatibilities with more modern systems, or more modern software. Our build system is a OSX Leopard system (10.5) which doesn't sound so old I suppose but a lot has changed. Also most systems where 32 bit at the time, and our build system is also 32 bit.

We found trying to run Steam's contentprep.app on a 32 bit OSX system, certain library dependencies could not be met. Firstly we released that contentprep.app is in actuality a Python script, packaged as an application. Secondly upon troubleshooting we discovered the the contentprep.app was looking for the WX Widgets library for Python. This was initially puzzling because we were aware that Python on OSX does normally ship with WX library. However; and this is the important part - only for 32 bit Python. Once we this was understood the fix was simple. Run contentprep.app from the command line using arch.

pinkachu$ arch -arch i386 python contentprep.app/Content/MacOS/contentprep.py

And this works like a charm now