PDA

View Full Version : How to use glreadpixels()



ravibujji
01-28-2003, 05:30 AM
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

jleffelm
01-30-2003, 11:59 AM
Originally posted by ravibujji:
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

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 );