MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilutGLScreen

Function ILAPIENTRY ilutGLScreen

DevIL/src-ILUT/src/ilut_opengl.cpp:726–746  ·  view source on GitHub ↗

Takes a screenshot of the current OpenGL window.

Source from the content-addressed store, hash-verified

724
725//! Takes a screenshot of the current OpenGL window.
726ILboolean ILAPIENTRY ilutGLScreen()
727{
728 ILuint ViewPort[4];
729
730 ilutCurImage = ilGetCurImage();
731 if (ilutCurImage == NULL) {
732 ilSetError(ILUT_ILLEGAL_OPERATION);
733 return IL_FALSE;
734 }
735
736 glGetIntegerv(GL_VIEWPORT, (GLint*)ViewPort);
737
738 if (!ilTexImage(ViewPort[2], ViewPort[3], 1, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL))
739 return IL_FALSE; // Error already set.
740 ilutCurImage->Origin = IL_ORIGIN_LOWER_LEFT;
741
742 glPixelStorei(GL_PACK_ALIGNMENT, 1);
743 glReadPixels(0, 0, ViewPort[2], ViewPort[3], GL_RGB, GL_UNSIGNED_BYTE, ilutCurImage->Data);
744
745 return IL_TRUE;
746}
747
748
749#ifndef _WIN32_WCE

Callers

nothing calls this directly

Calls 1

ilSetErrorFunction · 0.85

Tested by

no test coverage detected