Look at this thread: http://www.gamedev.n...g-glreadpixels/
Check what is the value of gluErrorString(glGetError()) after the call to glReadBuffer. Overall, the code seems legit, but I'm not an OpenGL expert by any means.
Do you draw something in OpenGL? When do you call this Screenshot function?
GL_FRONT_AND_BACK seems to be illegal value for glReadBuffer. Try with GL_FRONT_LEFT instead. Quoting the documentation:
Specifies a color buffer.
Accepted values are
where i is between 0 and the value of GL_AUX_BUFFERS minus 1.
Nonstereo double-buffered configurations have only a front left and a back left buffer