From 1ad6bc34323f5b30d463ebe47a58d47ff9d4f328 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 19:17:50 +0200 Subject: [add]: Texture and Pixel buffers --- src/Platform/OpenGL/OpenGLTexture.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/Platform/OpenGL/OpenGLTexture.h (limited to 'src/Platform/OpenGL/OpenGLTexture.h') diff --git a/src/Platform/OpenGL/OpenGLTexture.h b/src/Platform/OpenGL/OpenGLTexture.h new file mode 100644 index 0000000..4a95ab4 --- /dev/null +++ b/src/Platform/OpenGL/OpenGLTexture.h @@ -0,0 +1,33 @@ +#pragma once + +#include "Rendering/Texture.h" +#include + +namespace Donut +{ + class OpenGLTexture2D : public Texture2D + { + public: + OpenGLTexture2D(uint32_t width, uint32_t height); + OpenGLTexture2D(const std::string& path); + virtual ~OpenGLTexture2D(); + + virtual uint32_t GetWidth() const override { return m_Width; } + virtual uint32_t GetHeight() const override { return m_Height; } + virtual uint32_t GetRendererID() const override { return m_RendererID; } + + virtual void SetData(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_RendererID == other.GetRendererID(); + } + + private: + std::string m_Path; + uint32_t m_Width, m_Height; + uint32_t m_RendererID; + GLenum m_InternalFormat, m_DataFormat; + }; +} -- cgit v1.3