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