Hello, since i broke my PC i'm forced to use my mac, so I started looking around how to hook OpenGL.
I doubt there are many people around here that use a mac (especially for gaming), but for the ones that do, or for people that are interested in ABI's this is might be interesting for you :D
There are three ways (that i know of) to hook library calls, the first one is using LD_PRELOAD, which, works perfectly, and is very simple to use.
The second method is what i will be explaining here, and the third one is pretty hard, if anyone is interested in it look up mach_star (mach_override).

The whole idea is basically changing the address in the jump table of the file format that MAC uses, Mach-O. (PE/COFF on Windows).
This, however, is slightly harder than on Windows. Since it is too long to write down here i wrote a pdf.
I hope you enjoy reading it, here it is.

PS: This is very very similar to the ELF format for Linux, so if you are using Linux this is definitely useful for you too.

Peace.