I was going to suggest creating a buffer and getting a pointer to the OpenGL buffer - if possible. Once you get the pointer to the GL buffer and have established a valid pointer to another buffer...the rest is easy.
Code:
void Copy32(DWORD *pSource,DWORD *pDest,DWORD dwSize)
{
asm {
cld
mov esi,[pSource]
mov edi,[pDest]
mov ecx,dwSize
rep stosd
and ecx,03h
rep stosb
}
}
This will copy Source to Dest 32-bits at a time - or one pixel per iteration in 32-bit color. pDest will be an exact copy of pSource. Write pDest to a file using any format you like. It is up to you to encode the format for the file. But getting the raw data is quite simple.