Created
September 26, 2013 12:13
-
-
Save Trass3r/6713302 to your computer and use it in GitHub Desktop.
quickly dump OpenGL texture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glBindTexture(GL_TEXTURE_2D, textureID); | |
glPixelStorei(GL_PACK_ALIGNMENT, 1); | |
GLint width, height, level = 0; | |
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, &width); | |
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, &height); | |
std::unique_ptr<unsigned short[]> data(new unsigned short[width * height]); | |
glGetTexImage(GL_TEXTURE_2D, level, GL_RED, GL_UNSIGNED_SHORT, data.get()); | |
glPixelStorei(GL_PACK_ALIGNMENT, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment