diff options
| author | hachem <im@hachem.wtf> | 2025-08-12 19:17:50 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-12 19:17:50 +0200 |
| commit | 3b02022fd79ad0e130b8c49e7707d221bfc97bb5 (patch) | |
| tree | 0da9ee9559969a7f40d92611a3b1c234e38ae36f /src/platform/opengl/opengl_texture.h | |
| parent | 7e06a916e6a385c37075abcb83d14b8c1fef7bc0 (diff) | |
feat: texture and pixel buffers
Diffstat (limited to 'src/platform/opengl/opengl_texture.h')
| -rw-r--r-- | src/platform/opengl/opengl_texture.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/platform/opengl/opengl_texture.h b/src/platform/opengl/opengl_texture.h new file mode 100644 index 0000000..0782e8b --- /dev/null +++ b/src/platform/opengl/opengl_texture.h @@ -0,0 +1,33 @@ +#pragma once + +#include "rendering/texture.h" +#include <glad/glad.h> + +namespace Donut +{ + class OpenGLTexture2D : public Texture2D + { + public: + OpenGLTexture2D(uint32_t width, uint32_t height); + OpenGLTexture2D(const std::string& path); + virtual ~OpenGLTexture2D(); + + virtual uint32_t get_width() const override { return m_width; } + virtual uint32_t get_height() const override { return m_height; } + virtual uint32_t get_renderer_id() const override { return m_renderer_id; } + + virtual void set_data(void* data, uint32_t size) override; + virtual void bind(uint32_t slot = 0) const override; + + virtual bool operator==(const Texture& other) const override + { + return m_renderer_id == other.get_renderer_id(); + } + + private: + std::string m_path; + uint32_t m_width, m_height; + uint32_t m_renderer_id; + GLenum m_internal_format, m_data_format; + }; +} |
