diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-13 23:48:00 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-13 23:48:00 +0100 |
commit | 2a128d32fcd6fab743331bcb597148e7d2caeed1 (patch) | |
tree | e6032712b71ba76ccb9c63fb0b168bdee322cf41 /gfx/models/texture.cpp | |
parent | Scoped Builder::Ptr (diff) | |
download | ilt-2a128d32fcd6fab743331bcb597148e7d2caeed1.tar.bz2 ilt-2a128d32fcd6fab743331bcb597148e7d2caeed1.tar.xz ilt-2a128d32fcd6fab743331bcb597148e7d2caeed1.zip |
Allow creating a texture directly from an Image
Diffstat (limited to 'gfx/models/texture.cpp')
-rw-r--r-- | gfx/models/texture.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp index 79376bc..cff44f9 100644 --- a/gfx/models/texture.cpp +++ b/gfx/models/texture.cpp @@ -8,10 +8,13 @@ Cache<Texture, std::filesystem::path> Texture::cachedTexture;
-Texture::Texture(const std::filesystem::path & fileName)
+Texture::Texture(const std::filesystem::path & fileName) :
+ Texture {Image {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha}}
{
- const Image tex {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha};
+}
+Texture::Texture(const Image & tex)
+{
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|