Hmm... I created my Win/Lin window manager through pain and sweat, plunging through a lot of unknown, reading good manuals and obscure sources... Maybe I'll be able to help someway.

Most of the functions are gathered in one dynamic library. I use libGL.so.1, it's the analog of Win's opengl32.dll.
The most important is the GLX extension (a replacement of wgl*). AFAIK, FPC should have a "glx" unit, I can't remember exactly because I use my own modification of all the OpenGL header modules.

My code for creating the window and initializing OpenGL could be seen here:
http://host-17-99.imsys.net/cge/_tmpopenglexamplecode/
Of some interest to you may be the cl_winman.inc
ex.:[pascal]Procedure TCLWindow.SwapBuffers;
begin
{$ifdef unix}
glXSwapBuffers(Display, WindowHandle);
{$else}
wglSwapBuffers(display);
{$endif}
end;[/pascal]
all the *.h and *.inc are included in cl_hub.pp, which uses x , xlib, xutil, dl that are needed by the window manager.

A rough and somewhat incomplete stuff, but it should give you a insight. Because it's a live thing that works.


In short, as I understand it, the aforementioned Lazarus component was created for people to avoid this horror altogether. Probably all you need to work with opengl in linux is attach the opengl unit.