How to use glreadpixels()

hai ,
i am entry level OpenGL Programmer. i have an image(object), i want to capture(save) all the dimensions of the image.(image is cube), can any one help me regarding this.

thank you very much

with regards

Originally posted by ravibujji:
[b]hai ,
i am entry level OpenGL Programmer. i have an image(object), i want to capture(save) all the dimensions of the image.(image is cube), can any one help me regarding this.

thank you very much

with regards [/b]

This is how you would go aboue reading a screen area of width x height, reading the color in as BlueGreenRed(I was eventually outputting to bitmaps, and it was needed this way), and the values as unsigned bytes.

static unsigned char *buf;
buf = new unsigned char[( 3 * (width) * (height) )];

glReadPixels( 0, 0, width, height, GL_BGR_EXT, GL_UNSIGNED_BYTE, buf );