Original Post
Hi every1.
Is there a function in OpenGL to capture a screen shot of the 3D window and save it to an image format such as BMP?
Thanks in advance.
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
// to take a screenshot
void *data;
glReadPixels(0, 0, screenWidth, screenHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
// now write data to a file
// NOTE: remember that 0, 0 in OpenGL is the _bottom_ left corner of the screen
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more