openGL/glX colour question for the gurus.

I am looking for help with regards to grabbing an opengl widget/screen as a pixmap object. Under straight X it would go
something like:

XgetWindowAttributes(); // To get the colormap and the visual.
XgetImage();
XgetPixel();
XqueryColour();

This does work to a certain degree for OpenGL widgets, the geometry is correct, however the colours are all screwed up.

Is there a way to accomplish this for an openGL widget using standard X calls?

Thankyou for any help.

James Oliver