Skip to content

Add macOS support#126

Open
diminox-kullwinder wants to merge 1 commit into
unlimitedbacon:masterfrom
diminox-kullwinder:macos-support
Open

Add macOS support#126
diminox-kullwinder wants to merge 1 commit into
unlimitedbacon:masterfrom
diminox-kullwinder:macos-support

Conversation

@diminox-kullwinder
Copy link
Copy Markdown

@diminox-kullwinder diminox-kullwinder commented Feb 6, 2026

Summary

This PR adds native macOS support to stl-thumb, enabling headless thumbnail rendering on Apple systems.

Changes

1. macOS headless display (src/lib.rs)

Added create_headless_display implementation for target_os = "macos" using the same pattern as Windows (simpler than Linux's multi-fallback approach).

2. GLSL shader updates (all shaders)

macOS's OpenGL core profile requires GLSL 150+. Updated all shaders:

  • #version 120#version 150
  • attributein
  • varyingout / in
  • texture2D()texture()
  • gl_FragColor → explicit out vec4 fragColor

These changes are backwards compatible with Linux/Windows as GLSL 150 is widely supported.

Testing

Tested on macOS 14.x (Sonoma) with Intel x86_64:

  • STL files: ~0.6s render time
  • OBJ files: ~0.3s render time
  • 3MF files: ~20s render time (complex format)

Notes

  • macOS deprecated OpenGL in favor of Metal, but OpenGL still works and is the path of least resistance for cross-platform support
  • The headless context approach is simpler on macOS than Linux (no surfaceless/osmesa fallbacks needed)

- Add create_headless_display for target_os macos
- Update GLSL shaders to version 150 (required for macOS core profile)
- Change attribute/varying to in/out, texture2D to texture
- Tested on macOS 14.x Sonoma with Apple Silicon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant