aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mgl0
-rw-r--r--include/mglpp/graphics/Texture.hpp5
-rw-r--r--src/graphics/Texture.cpp8
3 files changed, 13 insertions, 0 deletions
diff --git a/depends/mgl b/depends/mgl
-Subproject f1ede6cfa5cc2af2e7f93e29f2311e9ece7f41c
+Subproject 8731a00681a2cf99965203849bd7ba8f6c09df9
diff --git a/include/mglpp/graphics/Texture.hpp b/include/mglpp/graphics/Texture.hpp
index 8bd2df6..1ea040e 100644
--- a/include/mglpp/graphics/Texture.hpp
+++ b/include/mglpp/graphics/Texture.hpp
@@ -17,7 +17,12 @@ namespace mgl {
bool mipmap = false; /* available since opengl 3.0 */
};
+ struct ReferenceOptions {
+ bool pixel_coordinates = false;
+ };
+
Texture();
+ Texture(unsigned int gl_texture_id, mgl_texture_format format, const ReferenceOptions reference_options = {false});
Texture(Texture &&other);
Texture& operator=(Texture &&other);
~Texture();
diff --git a/src/graphics/Texture.cpp b/src/graphics/Texture.cpp
index 0c4b7fc..3b1f410 100644
--- a/src/graphics/Texture.cpp
+++ b/src/graphics/Texture.cpp
@@ -7,6 +7,14 @@ namespace mgl {
memset(&texture, 0, sizeof(mgl_texture));
}
+ Texture::Texture(unsigned int gl_texture_id, mgl_texture_format format, const ReferenceOptions reference_options) {
+ memset(&texture, 0, sizeof(mgl_texture));
+ const mgl_texture_reference_options texture_reference_options = {
+ reference_options.pixel_coordinates
+ };
+ mgl_texture_init_reference_existing_gl_texture(&texture, gl_texture_id, format, &texture_reference_options);
+ }
+
Texture::Texture(Texture &&other) {
memcpy(&texture, &other.texture, sizeof(mgl_texture));
owned = other.owned;