Well that's different to recording the desktop - I'm pretty sure the program I suggested won't work. You want something that can record DirectX or OpenGL footage. That would mean something like Fraps, but off the top of my head I can't think of a similar freeware program.
Edit: After spending a bit of time googling, I found this program, that claims to be the open source version of Fraps. Try it out and let us know how you get on with it compared to the fraps demo, if it's successful I can start recommending it instead of Fraps.