Writing shaders on macOS

Hello there,

I’ve been working on a top down 2D game for quite a while now. However, I came to a point where I need to write shaders for a particle and lighting system (see this GitHub - scarsty/SDL2-particles: A Particle System for SDL2 for a particle system solely using SDL and no shaders). As you might expect, the performance drawbacks are significant (up from 15% to 25% CPU for any of the example particle effects).

So here is the deal: I’m working on a Mac so OpenGl ain’t unfortunately no viable solution for the long run. How can I write and implement shaders into my game, preferably using Metal? Do I have to create a Metal context (as with OpenGL)? If yes, how do I do that, and how to I start from there?

Cheers,

As far as I’m aware, OpenGL is deprecated on MacOS but there is no indication (as yet) that it will actually be removed. It’s notable, for example, that OpenGL is fully functional on the newest ‘Apple Silicon’ Macs.

Currently, OpenGL / OpenGLES / WebGL is almost universal: it’s available in Windows, MacOS, Linux, Android, iOS and in web browsers. It seems to me that Apple would be crazy to exclude Macs from this ecosystem.

That’s not to say they won’t - they’ve done crazy things in the past - but unless you have inside information to the contrary we haven’t yet reached that point.

You’re probably right. By the time they’ll have it completely deleted, my current Mac will be outdated and I’ll be going for a PC. I’d be damned if I don’t.