diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-29 18:50:02 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-29 18:50:02 +0100 |
commit | 4fb3a5ae0f53a6fa3f4901f92e64f1de8d2dbb17 (patch) | |
tree | 6f4bd0c999e3b4a11410aed234622e80842261ad /ui/icon.cpp | |
parent | Lookup material details once in the vertex shader (diff) | |
download | ilt-4fb3a5ae0f53a6fa3f4901f92e64f1de8d2dbb17.tar.bz2 ilt-4fb3a5ae0f53a6fa3f4901f92e64f1de8d2dbb17.tar.xz ilt-4fb3a5ae0f53a6fa3f4901f92e64f1de8d2dbb17.zip |
Dunno how, but some DOS new lines got in here!
Diffstat (limited to 'ui/icon.cpp')
-rw-r--r-- | ui/icon.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/ui/icon.cpp b/ui/icon.cpp index ee88317..be1a63c 100644 --- a/ui/icon.cpp +++ b/ui/icon.cpp @@ -1,30 +1,30 @@ -#include "icon.h"
-#include "glArrays.h"
-#include <GL/glew.h>
-#include <gfx/image.h>
-#include <resource.h>
-#include <stb/stb_image.h>
-
-Icon::Icon(const std::filesystem::path & fileName) : Icon {Image {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha}}
-{
-}
-
-Icon::Icon(const Image & tex) : size {tex.width, tex.height}
-{
- glBindTexture(GL_TEXTURE_2D, m_texture);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(tex.width), static_cast<GLsizei>(tex.height), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, tex.data.data());
-}
-
-void
-Icon::Bind() const
-{
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_texture);
-}
+#include "icon.h" +#include "glArrays.h" +#include <GL/glew.h> +#include <gfx/image.h> +#include <resource.h> +#include <stb/stb_image.h> + +Icon::Icon(const std::filesystem::path & fileName) : Icon {Image {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha}} +{ +} + +Icon::Icon(const Image & tex) : size {tex.width, tex.height} +{ + glBindTexture(GL_TEXTURE_2D, m_texture); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(tex.width), static_cast<GLsizei>(tex.height), 0, + GL_RGBA, GL_UNSIGNED_BYTE, tex.data.data()); +} + +void +Icon::Bind() const +{ + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, m_texture); +} |