summaryrefslogtreecommitdiff
path: root/gfx/models/texture.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 16:44:19 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 16:44:19 +0000
commit7c03d93c367b842c464dca30e121bc4c20547c36 (patch)
tree6df340dc3b0bd16f6ced2a051a68fc8a3c67a08c /gfx/models/texture.cpp
parentFirst iteration with font/text support (diff)
downloadilt-7c03d93c367b842c464dca30e121bc4c20547c36.tar.bz2
ilt-7c03d93c367b842c464dca30e121bc4c20547c36.tar.xz
ilt-7c03d93c367b842c464dca30e121bc4c20547c36.zip
Generic solution for glGen/glDel arrays, then tidy-up the uses
Diffstat (limited to 'gfx/models/texture.cpp')
-rw-r--r--gfx/models/texture.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp
index cd275e8..612f0a0 100644
--- a/gfx/models/texture.cpp
+++ b/gfx/models/texture.cpp
@@ -1,4 +1,6 @@
#include "texture.h"
+#include "glArrays.h"
+#include <GL/glew.h>
#include <cache.h>
#include <gfx/image.h>
#include <resource.h>
@@ -6,11 +8,10 @@
Cache<Texture> Texture::cachedTexture;
-Texture::Texture(const std::filesystem::path & fileName) : m_texture {}
+Texture::Texture(const std::filesystem::path & fileName)
{
const Image tex {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha};
- glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -22,11 +23,6 @@ Texture::Texture(const std::filesystem::path & fileName) : m_texture {}
GL_RGBA, GL_UNSIGNED_BYTE, tex.data.data());
}
-Texture::~Texture()
-{
- glDeleteTextures(1, &m_texture);
-}
-
void
Texture::Bind() const
{