diff options
author | chai <chaifix@163.com> | 2019-04-02 08:47:15 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-02 08:47:15 +0800 |
commit | 250e30d73f09e9da2b5a81d0fbae63744ae12a73 (patch) | |
tree | 0f55daf334c073e1779d7a1284799a2056aad714 /source/modules/asura-core/graphics/image.cpp | |
parent | 66fe16dd5ed57ae958fc25158d0defae2e6fae6a (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/image.cpp')
-rw-r--r-- | source/modules/asura-core/graphics/image.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp index bdd8c3d..2b274c2 100644 --- a/source/modules/asura-core/graphics/image.cpp +++ b/source/modules/asura-core/graphics/image.cpp @@ -18,7 +18,6 @@ namespace AsuraEngine { } - //\Ϣ bool Image::Refresh(DecodedData* data) { ASSERT(data); @@ -27,14 +26,22 @@ namespace AsuraEngine ASSERT(imgData); glBindTexture(GL_TEXTURE_2D, mTex); - imgData->Lock(); int width = imgData->width; int height = imgData->height; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgData->pixels); + TextureFormat tf = ConvertColorFormat(imgData->format); + glTexImage2D( + GL_TEXTURE_2D + , 0 + , tf.internalformat + , width, height + , 0 + , tf.externalformat + , tf.type + , imgData->pixels + ); mImageData = imgData; imgData->Unlock(); - glBindTexture(GL_TEXTURE_2D, 0); return true; |