summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Image.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-01 08:50:34 +0800
committerchai <chaifix@163.com>2019-03-01 08:50:34 +0800
commit64d9d7b3eb7cece81da8b2cb56eb0f50d87a5964 (patch)
tree12bde99e5415f77f60f8873a66d09bfd3b84ec48 /Source/Asura.Engine/Graphics/Image.cpp
parente28a7d48d032fe7fd4c8789e95fbc659873a0adc (diff)
*misc
Diffstat (limited to 'Source/Asura.Engine/Graphics/Image.cpp')
-rw-r--r--Source/Asura.Engine/Graphics/Image.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/Asura.Engine/Graphics/Image.cpp b/Source/Asura.Engine/Graphics/Image.cpp
index e19d57f..8287d76 100644
--- a/Source/Asura.Engine/Graphics/Image.cpp
+++ b/Source/Asura.Engine/Graphics/Image.cpp
@@ -1,4 +1,5 @@
#include "Image.h"
+#include "GL.h"
namespace AsuraEngine
{
@@ -7,30 +8,25 @@ namespace AsuraEngine
Image::Image()
: Texture()
- , mPixels(nullptr)
- , mWidth(0)
- , mHeight(0)
{
}
Image::~Image()
{
- delete mPixels;
}
- bool Image::Load(const void* data, size_t size)
+ //\Ϣ
+ bool Image::Load(const ImageData* data)
{
-
- }
-
- void Image::Render(int x, int y, int sx, int sy, int ox, int oy, int r)
- {
-
- }
-
- void Image::Render(const Math::Rect& quad, int x, int y, int sx, int sy, int ox, int oy, int r)
- {
-
+ if (!data)
+ return false;
+ if (mImageData)
+ delete mImageData;
+ mImageData = data;
+ glBindTexture(GL_TEXTURE_2D, mTextureHandle);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data->pixels);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ return true;
}
}