Takes a screenshot of the current OpenGL window.
| 724 | |
| 725 | //! Takes a screenshot of the current OpenGL window. |
| 726 | ILboolean 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 |
nothing calls this directly
no test coverage detected