Hooking Into an OpenGL Application

I don’t know about you, but reading my subject line sets off alarms in my head. It’s descriptive of my question, so I don’t want to change it, but let me assert this before I continue:
I am not a hacker, an aimbotter, or any other malicious user of games, and I’m asking this question regarding application integration because I want to be able to use another application within a game, not because I want another application to alter the game.
Now that that’s said, I started using XFire today, and I was impressed by its convenience. Getting a chat client from directly within a game is very useful under many circumstances, and I wanted to investigate whether something along these lines was possible for Linux, specifically as a plugin or modification for Pidgin (a multipurpose instant messaging client).
How would I go about “hooking” into a game running with OpenGL? I would need to be able to capture input and draw a UI. Ideally, I would get a test application of this running and then investigate the feasibility of a Pidgin plugin.
The main question that I see right now is whether I should investigate hooking through the X API or through OpenGL. Hooking through OpenGL would be platform independent (most likely, anyway), which would be a plus, but I’m not sure how I should go about it. Googling it gives a list of hack and bot sites that use invasive injection techniques. I’m hoping there’s something less intrusive, even if it’s less capable. Setting off Punkbuster would make the UI integration useless under certain games, although there are only a few on Linux.

Right now, I’m going to investigate how Mumble (a voice chat application) draws an overlay over an OpenGL application. I don’t think it does any input handling, but it draws a list of the people you’re chatting with,