From 43394c8a8908442982e3a7e25975c31b3c952923 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Sun, 27 Oct 2024 12:52:55 +0200 Subject: root --- graphics/texture.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 graphics/texture.h (limited to 'graphics/texture.h') diff --git a/graphics/texture.h b/graphics/texture.h new file mode 100644 index 0000000..c0d16e3 --- /dev/null +++ b/graphics/texture.h @@ -0,0 +1,36 @@ +#pragma once +#include +#include +#include +#include + +namespace graphics +{ + class Texture + { + private: + GLuint m_id = 0; + std::string m_filename; + unsigned int m_width, m_height; + unsigned int m_channels; + std::vector m_buffer; + bool m_ready = false; + void makePowerOfTwo(); + bool load(const std::string & file); + void buildGLTexture(); + public: + Texture(const std::string & filename); + GLuint getID() { return m_id; } + int getWidth() { return m_width; } + int getHeight() { return m_height; } + + }; + + class TextureManager + { + private: + std::unordered_map textures; + public: + GLuint getTexture(std::string file); + }; +} -- cgit v1.2.3