Forum > OpenGL
Metal Framework for MacOS
ChrisR:
I have created a few Lazarus projects that can be compiled for Apple's new Metal API.
https://github.com/neurolabusc/Metal-Demos
Most of these projects can also be compiled to support OpenGL 3.3 Core - providing support for Windows, Linux and older Macs. By keeping a thin layer for either OpenGL or Metal, one can retain most of Lazarus' "write once, compile everywhere" magic.
The documentation is sparse, but both the main page and the line project include some useful information
https://github.com/neurolabusc/Metal-Demos/tree/master/lines
The Metal support uses Ryan Joseph's lazmetalcontrol
https://github.com/genericptr/Metal-Framework
My examples all use Lazarus. However, Ryan's repository also includes some examples of how to use Metal directly from freepascal without Lazarus.
Ryan deserves incredible credit - has framework provides a great a very simple way to use this powerful but complex API.
Igor Kokarev:
Hi Chris,
Thanks for your demos with Metal API on macOS!
Can you check MeshProj project with Lazarus 2.0.6?
We have the following error during compilation on macOS High Sierra:
glcocoanscontext(506,45) Error: identifier idents no member "KeyEvent"
glcocoanscontext(512,45) Error: identifier idents no member "KeyEvent"
glcocoanscontext(518,45) Error: identifier idents no member "KeyEvent"
Project: Metal-Demos-master/mesh/MeshProj.lpi
trev:
I've added this overlooked macOS gem to the Wiki: https://wiki.freepascal.org/Metal_Framework
Igor Kokarev:
Thanks, one correction:
"to use Metal you will need macOS 10.12 (Sierra)"
Metal was introduced in macOS 10.11 (El Capitan).
ChrisR:
The Lazarus 2.0.6 release for MacOS contained a regression for OpenGL support.
https://bugs.freepascal.org/view.php?id=35797
GLCocoaNSContext.pas now requires "cocoa_extra" in uses section. You can either edit your copy or get a new copy from trunk
https://github.com/graemeg/lazarus/tree/upstream/components/opengl
Alternatively, you can use Lazarus trunk rather than 2.0.6.
Navigation
[0] Message Index
[#] Next page