An NSOpenGLView does not actually draw inside the window; it draws on a surface that is higher or lower than the window, higher by default. If you need a control in front of an OpenGL surface, you must make the surface under the window using the NSOpenGLContext NSOpenGLCPSurfaceOrder parameter. But then you have to cut out the transparent rectangle in the window to see the surface of OpenGL.
Edit to add: as an alternative, you can make a transparent overlay or child window located above the OpenGL surface, as well as the main window and place the control there. Not sure which way will be easier.
source share