i have an openGL and i want to be able to press a certain key and the image is stored into a buffer then written out in a folder as a .bmp file. so far this is what i have…to an extent…
after the glReadPixels i dont know where to go from there. i have my buffer stored of the current screen. as you can see i am using GLUT, not something propietary like windows, so this would need to work on windows and linux at the least, preferable OS X and SGI systems… thanks all for your help in advance!
void saveScreen()
{
int nWidth = glutGet( GLUT_WINDOW_WIDTH );
int nHeight = glutGet( GLUT_WINDOW_HEIGHT );
//my buffer
unsigned char* pcBuffer =
new unsigned char[nWidth * nHeight * 3];
glReadBuffer( GL_BACK );
glReadPixels( 0, 0,
nWidth, nHeight,
GL_RGB,
GL_UNSIGNED_BYTE,
(GLvoid*)pcBuffer);
…
…
???
}
//this is in glut keyboard function
if(capture button is pressed, whatever that is)
saveScreen();