diff options
author | chai <chaifix@163.com> | 2018-09-02 10:47:18 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-02 10:47:18 +0800 |
commit | 6d67345bd5ddea7a4ce37e6bbeda15d341b1ee82 (patch) | |
tree | 2d41b1ba3bd68ced24e11cb801a61d5417357229 /src/libjin/Graphics/Texture.cpp | |
parent | bbecfee3b69fd2d2015305f3d04c02f87d4924b0 (diff) |
*update
Diffstat (limited to 'src/libjin/Graphics/Texture.cpp')
-rw-r--r-- | src/libjin/Graphics/Texture.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libjin/Graphics/Texture.cpp b/src/libjin/Graphics/Texture.cpp index f3c08fb..633eeac 100644 --- a/src/libjin/Graphics/Texture.cpp +++ b/src/libjin/Graphics/Texture.cpp @@ -71,17 +71,16 @@ namespace graphics // ʹstbi_load_from_memory int w; int h; - unsigned char* textureData = stbi_load_from_memory((unsigned char *)b, s, &w, &h, NULL, STBI_rgb_alpha); - if (textureData == 0) return false; + pixels = (color*)stbi_load_from_memory((unsigned char *)b, s, &w, &h, NULL, STBI_rgb_alpha); + if (pixels == 0) return false; size.x = w; size.y = h; - pixels = (color*)textureData; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); vertCoord[0] = 0; vertCoord[1] = 1; vertCoord[2] = 0; vertCoord[3] = h; |