summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Image.cpp
diff options
context:
space:
mode:
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;
}
}