Xcode and Cg or GLSL Shaders... It is possible

Apple provides this interesting tool for writing code on a Mac with OSX called 'xcode'. It is particularly interesting because it is deceptively powerful:

- Codesense is available to help you complete your keywords, function names, defines and so on. But, you have to know it is there and press ESC.

- you can create syntax highlighting profiles for other languages, including shader languages such as Cg or GLSL. But attempts at finding the documentation for this feature proved futile. Nonetheless, with some guesswork:


example desktop


Installation

To install for all users, place the files in /Library/Application Support/Xcode/Specifications/

To install for the current user, place in ~/Library/Application Support/Xcode/Specifications/


Cg:

This file associates .cg files with the Cg syntax: cg.pbfilespec

This file dictates the cg syntax highlighting rules: cg.pblangspec

GLSL (see thanks below):

This file associates .frag & .vert files with GLSL syntax: glsl.pbfilespec

This file dictates the GLSL syntax highlighting rules: glsl.pblangspec


Thanks! and License

Thanks to Matthias Biedermann, who has contributed files to correctly highlight GLSL! Thanks also to Erik Peterson, who pointed out that xcode is now case sensitive (these files should work again).


You are free to do what you wish with the specification files. Normal legal limitations apply ("You accept the software AS IS and won't sue me"), but otherwise they are yours to play with. You are encouraged to let me know if you like them or would like to see more features added...



My email address is not published on this website to avoid spam. It is in my publications.