aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/OpenGL/OpenGLVertexArray.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-12 18:12:37 +0200
committerhachem <im@hachem.wtf>2025-08-12 18:12:37 +0200
commita2ec7dabd48a70ea69623406ddd0f8f97af403c8 (patch)
tree52d71b51753b88473607f5e97f8bc15bdb5ad7d3 /src/Platform/OpenGL/OpenGLVertexArray.h
parent16dff443789c7f1461b46ce52966972ae14c042b (diff)
[add]: Start of a basic rendering backend
Diffstat (limited to 'src/Platform/OpenGL/OpenGLVertexArray.h')
-rw-r--r--src/Platform/OpenGL/OpenGLVertexArray.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Platform/OpenGL/OpenGLVertexArray.h b/src/Platform/OpenGL/OpenGLVertexArray.h
new file mode 100644
index 0000000..6783140
--- /dev/null
+++ b/src/Platform/OpenGL/OpenGLVertexArray.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "Rendering/VertexArray.h"
+#include <vector>
+#include <memory>
+
+namespace Donut
+{
+ class VertexBuffer;
+ class IndexBuffer;
+
+ class OpenGLVertexArray
+ : public VertexArray
+ {
+ public:
+ OpenGLVertexArray();
+ virtual ~OpenGLVertexArray();
+
+ virtual void Bind() const override;
+ virtual void Unbind() const override;
+
+ virtual void AddVertexBuffer(const std::shared_ptr<VertexBuffer>& vertexBuffer) override;
+ virtual void SetIndexBuffer(const std::shared_ptr<IndexBuffer>& indexBuffer) override;
+
+ virtual const std::vector<std::shared_ptr<VertexBuffer>>& GetVertexBuffers() const override
+ {
+ return m_VertexBuffers;
+ }
+
+ virtual const std::shared_ptr<IndexBuffer>& GetIndexBuffer() const override
+ {
+ return m_IndexBuffer;
+ }
+ private:
+ uint32_t m_RendererID;
+ uint32_t m_VertexBufferIndex = 0;
+ std::vector<std::shared_ptr<VertexBuffer>> m_VertexBuffers;
+ std::shared_ptr<IndexBuffer> m_IndexBuffer;
+ };
+};