From 7c03d93c367b842c464dca30e121bc4c20547c36 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 Jan 2022 16:44:19 +0000 Subject: Generic solution for glGen/glDel arrays, then tidy-up the uses --- gfx/models/texture.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'gfx/models/texture.cpp') 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 #include #include #include @@ -6,11 +8,10 @@ Cache 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 { -- cgit v1.2.3