6

I would like to recreate the programs shown in this article on a Mac. Is this possible? My research so far has pointed to "no" but I don't want to give up just yet. Python is preferred but my purpose for this is simple enough that most any language is fine.

Edit: To elaborate on my goal, it is to write individual pixels to the screen with no background. I don't care if they're removed by mouse movements, and if there is a better way to do this than framebuffers I will use that.

  • What do you mean by writing to the screen *"with no background"*? – Mark Setchell May 12 '18 at 08:36
  • @MarkSetchell I want to draw on top of whatever is currently on the screen, with no window border, and with mouse and keyboard working normally and ignoring my program. – Riley Madison May 12 '18 at 16:21
  • Not sure I have understood you, but Eric shows an example here of how to create an X11 window without border or title bar... https://stackoverflow.com/a/41228386/2836621 – Mark Setchell May 12 '18 at 16:34

1 Answers1

1

Unfortunately, the MacOS kernel doesn't expose a file to access the framebuffer (such as /dev/fb0 on Linux).

There could be a way to do this using the MacOS APIs. In 2004 the DirectFB project had this working (here's the commit that added it: https://github.com/DirectFB/directfb/commit/cbe9cfd0446bfa8c6fcd18b7cbc805566eec9b5d#diff-250fcad7219dfcf74cf05db93c9070445945c9e39cd6529f67d1a00ea93961da ). However, in the last decade it's likely that these APIs have been deprecated and you'd have to look into whatever replaced them.

It's easy enough to use Metal or OpenGL though. Just make a fullscreen window, make two large triangles the size of the screen, and update their texture.

Ed Halferty
  • 136
  • 2
  • 10