MacOS can run legacy OpenGL up to version 2.1. If you want to use more recent features, you must use the OpenGL Core specification which has no fixed function pipeline and removes all legacy calls. Therefore, common targets for MacOS are OpenGL 2.1 or OpenGL Core 3.3. Note that with Windows and Linux the OpenGL runs in "compatibility" mode, which allows you to mix legacy OpenGL as well as modern OpenGL. Therefore, if you Lazarus OpenGL program works on MacOS, it should be easy to compile on Linux/Windows, but the reverse is not true.
So for MacOS you have three choices (all demonstrated by the projects below):
1. Compile Legacy OpenGL and use no features greater than OpenGL 2.1
2. Use OpenGL Core (e.g. OpenGL 3.3) and never use any legacy functions.
3. Use Metal for your MacOS projects, and OpenGL for Windows/Linux
If you want to have your OpenGL projects run on a M1 Mac, be aware there are some quirks, which I mention here:
https://github.com/neurolabusc/AppleSiliconForNeuroimagingHere are Lazarus projects that compile with "modern" OpenGL core on MacOS, Windows and Linux, without any other components (The "Legacy" folder provides legacy OpenGL for some of these projects):
https://github.com/neurolabusc/OpenGLCoreTutorialshttps://github.com/neurolabusc/plyviewFor MacOS, here are projects that will compile using Metal (e.g. "clrbar.lpi"), but some of these projects can also be compiled as OpenGL (for projects with the "_gl" in the filename, e.g. "clrbar_gl.lpi"). The OpenGL projects can be either compiled to legacy OpenGL or OpenGL core, depending on the "{$DEFINE COREGL}" compiler directive in glopts.inc
https://github.com/neurolabusc/Metal-Demos