How Do I Add/Write Custom Shaders Using Xamarin on OSX?

Hi,

I’ve searched and searched - can’t find any concrete info on this and keep going round in circles.

How can I add a custom shader to my project using Xamarin Studio on OSX so I can load it with effect = Content.Load(“MyEffect”);

I’m guessing the .fx file needs to be compiled somehow. Can I even do this under OS X?

cheers

You can’t compile shaders on OS X. They have to be compiled on a Windows machine. I personally setup a little Amazon EC2 instance with a little web service that compiles the shaders. Throw in a simple little command line script on OS X to interact with the web service and you can then compile on Macs in a roundabout manner.

OK thanks - would you mind giving me some pointers as to the simplest way to compile on Windows and then bring across to Mac.

Do I just import the .fx file into the pipeline tool and then load the resultant .xnb into my Mac project as I would other content elements?

cheers

Just add the .fx files to the .mgcb file as you normally would. On windows just build it to the target platform and then copy the resulting .xnb files to you mac.

OK - thanks - I will give it a go.

If you are going to be doing a lot of shader work I highly recommend using a VM running Windows and make yourself a little command line prog that compiles and spits out the shader right into your project.