aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphics/Texture.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/graphics/Texture.cpp b/src/graphics/Texture.cpp
index 1bcf3af..0c4b7fc 100644
--- a/src/graphics/Texture.cpp
+++ b/src/graphics/Texture.cpp
@@ -52,7 +52,13 @@ namespace mgl {
load_options.pixel_coordinates,
load_options.mipmap
};
- return mgl_texture_load_from_file(&texture, filepath, &texture_load_options) == 0;
+
+ if(mgl_texture_load_from_file(&texture, filepath, &texture_load_options) == 0) {
+ return true;
+ } else {
+ clear();
+ return false;
+ }
}
bool Texture::load_from_image(Image &image, const LoadOptions load_options) {
@@ -67,7 +73,13 @@ namespace mgl {
load_options.pixel_coordinates,
load_options.mipmap
};
- return mgl_texture_load_from_image(&texture, image.internal_image(), &texture_load_options) == 0;
+
+ if(mgl_texture_load_from_image(&texture, image.internal_image(), &texture_load_options) == 0) {
+ return true;
+ } else {
+ clear();
+ return false;
+ }
}
bool Texture::load_from_memory(const unsigned char *data, int width, int height, mgl_image_format format, LoadOptions load_options) {
@@ -82,7 +94,13 @@ namespace mgl {
load_options.pixel_coordinates,
load_options.mipmap
};
- return mgl_texture_load_from_memory(&texture, data, width, height, format, &texture_load_options) == 0;
+
+ if(mgl_texture_load_from_memory(&texture, data, width, height, format, &texture_load_options) == 0) {
+ return true;
+ } else {
+ clear();
+ return false;
+ }
}
void Texture::clear() {