Skip to content

v1.0.0 — cocoaKinect archive

Latest

Choose a tag to compare

@gridboy gridboy released this 11 Aug 13:57
· 2 commits to main since this release

Archive release of cocoaKinect, a native macOS Kinect viewer written in November 2010 by Robert Pointon (fernlightning) for the OpenKinect community.

This is not original work by the repository owner. The source is preserved here, reorganised and documented; all credit for the application code goes to the original author. See notes.txt for his own notes, reproduced verbatim.

Mesh mode

What it does

A Cocoa + OpenGL viewer built directly on libfreenect: live depth, RGB and IR streams; three draw modes (2D image, point cloud, triangle mesh); GLSL shading with a depth colormap; motor tilt and LED control; and export of the captured geometry to PLY, ASCII STL and binary STL.

What is in this release

The 2010 source, reorganised for readability, plus a set of fixes applied on top of it. git diff dc5c24b..v1.0.0 shows the full divergence from the original.

Performance — the real-time render path was costing far more CPU than it needed to:

before after
depth clamp 4.69 ms/frame 0.71 ms/frame 6.6x
mesh index build (full detail) 0.087 ms/frame 0.019 ms/frame 4.6x
allocator traffic 1.5 MB/frame none recycled

The clamp was making up to 7 objc_msgSend calls and 2 fmod() calls per pixel, over 307200 pixels, every frame. Both rewritten loops were checked against the originals over 960 randomised parameter combinations: byte-identical output.

Correctness — several real defects, found by reading and by -Wall:

  • The export actions waited for a frame in an unbounded spin loop. With no device streaming, that pinned a core on the main thread and froze the UI permanently. Nothing grayed the menu items out, so it was two clicks away.
  • saveSTLB counted facets in a pointer variable, so the arithmetic advanced by 16 instead of 2 — the binary STL header announced 8x more facets than were written.
  • Shader compile failures were logged with an NSString * passed to %s: garbage output or a crash, on the one path meant to report shader errors.
  • All three export paths leaked a 600 KB buffer per invocation.

Building

It builds and runs on an Intel Mac. On Apple Silicon the vendored libusb-1.0 binaries are x86_64 only and must be rebuilt or replaced first. Full notes in the README.

Nothing in this release has been run against real Kinect hardware.

Licensing

The application code carries no formal licence — main.m says "All rights reserved", while notes.txt grants permission informally. No LICENSE file is included, because the repository owner is not the copyright holder. The vendored dependencies do carry formal licences: libfreenect is Apache-2.0 or GPL-2.0 at your option, libusb is LGPL-2.1. See THIRD-PARTY-LICENSES.md before redistributing.