Added 'static' specifiers for non-kernel CL funcs at program scope.
Fixed OpenCL initialization to be slightly more robust.

On platforms with multiple devices (e.g. OS X Mavericks
with both Intel and Discrete GPU CL devices) we must
create the context and command queue with the correct
device in order to share resources with GL.