diff options
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; |