Are you doing this with Lazarus? It has lazOpenGLContext package which works same time on most operating systems.