aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/Texture.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-16 11:07:49 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-16 11:07:49 +0100
commit3a29b9984760af0b3a85e35190e1dede39e13891 (patch)
treec9baa5cb9204d15d081ef73a82729b493e6898fb /src/graphics/Texture.cpp
parent01e3403abf86050e4096ecf60466de4139ac78e2 (diff)
Implement all interfaces to mgl
Diffstat (limited to 'src/graphics/Texture.cpp')
-rw-r--r--src/graphics/Texture.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/graphics/Texture.cpp b/src/graphics/Texture.cpp
index cdaa3ba..f543c37 100644
--- a/src/graphics/Texture.cpp
+++ b/src/graphics/Texture.cpp
@@ -19,18 +19,32 @@ namespace mgl {
return instance;
}
- bool Texture::load_from_file(const char *filepath) {
+ bool Texture::load_from_file(const char *filepath, const LoadOptions load_options) {
if(texture.id)
return false;
- /* TODO: use the last arg (load options) */
- return mgl_texture_load_from_file(&texture, filepath, nullptr) == 0;
+
+ if(mgl_texture_init(&texture) != 0)
+ return false;
+
+ mgl_texture_load_options texture_load_options = {
+ load_options.compressed,
+ load_options.pixel_coordinates
+ };
+ return mgl_texture_load_from_file(&texture, filepath, &texture_load_options) == 0;
}
- bool Texture::load_from_image(Image &image) {
+ bool Texture::load_from_image(Image &image, const LoadOptions load_options) {
if(texture.id)
return false;
- /* TODO: use the last arg (load options) */
- return mgl_texture_load_from_image(&texture, image.internal_image(), nullptr) == 0;
+
+ if(mgl_texture_init(&texture) != 0)
+ return false;
+
+ mgl_texture_load_options texture_load_options = {
+ load_options.compressed,
+ load_options.pixel_coordinates
+ };
+ return mgl_texture_load_from_image(&texture, image.internal_image(), &texture_load_options) == 0;
}
vec2i Texture::get_size() const {
@@ -44,4 +58,4 @@ namespace mgl {
mgl_texture* Texture::internal_texture() {
return &texture;
}
-} \ No newline at end of file
+}