System: GNU/Linux (Ubuntu)
Compiler/IDE: Free Pascal
Libraries/API: OpenGL

I'm trying to add OpenGL support to my Allegro.pas project. To do that I must create an OpenGL window and tell to Allegro the handler/function of that window.

I can do it on MS-Windows but I have no idea about how to do it on X systems because I have almost no experience on X. I've looked on the Internet and everything I found is GLUT, GLX and SDL related, but I can't use that because Allegro must access to the window to intercept messages (keyboard, etc.). As I've seen in Allegro's sources it uses the lowest X11 level.

I've read some C code about how to add OpenGL support to the original Allegro but I see it too much complex to translate it directly to Pascal.

Can somebody help me?