Skip to content

Instantly share code, notes, and snippets.

@CanTheAlmighty
Last active March 10, 2024 08:43
Show Gist options
  • Save CanTheAlmighty/ee76fbf701a61651fe439fcd6d25f41d to your computer and use it in GitHub Desktop.
Save CanTheAlmighty/ee76fbf701a61651fe439fcd6d25f41d to your computer and use it in GitHub Desktop.
DisplayLink for OSX
@MacyEleanorMay
Copy link

This is based on the implementation done by Apple for MetalBasic3D example: https://developer.apple.com/library/ios/samplecode/MetalBasic3D/Introduction/Intro.html

I took that code and rewrote it in swift and moved into its own class, for easier integration when using Metal.

The Code example you're referring to isn't using a DisplayLink

@adamnemecek
Copy link

Note that since mac 10.11 there's CVDisplayLinkSetOutputHandler which makes setting up of the callback simpler.

@iOSBrett
Copy link

iOSBrett commented Apr 8, 2023

And they say swift is easy and requires fewer lines of code than objc... I setup a DisplayLink in about 5 lines of code in ObJC.
Swift is for people who love writing complicated code

This is for the Mac though. CADisplayLink for iOS is easy in either Swift or ObjC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment