diff options
| author | hachem <im@hachem.wtf> | 2026-08-20 22:05:09 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-20 22:05:09 +0200 |
| commit | 0f49e8fd2a364f91f0a4c3bc2210fac4d9bf2ecc (patch) | |
| tree | 8afb5564714fec75b19dbe3b7a42df2cfbee34c5 /src/platform/opengl/opengl_vertex_array.cpp | |
| parent | 85b63b3b61174a99811f3cba235da4537634edd4 (diff) | |
refactor: fold the OpenGL backend classes into rendering
Diffstat (limited to 'src/platform/opengl/opengl_vertex_array.cpp')
| -rw-r--r-- | src/platform/opengl/opengl_vertex_array.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/platform/opengl/opengl_vertex_array.cpp b/src/platform/opengl/opengl_vertex_array.cpp deleted file mode 100644 index a627224..0000000 --- a/src/platform/opengl/opengl_vertex_array.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include <glad/glad.h> - -#include "opengl_vertex_array.h" -#include "rendering/vertex_buffer.h" -#include "rendering/index_buffer.h" - -namespace Donut -{ - OpenGLVertexArray::OpenGLVertexArray() - { - glGenVertexArrays(1, &m_renderer_id); - } - - OpenGLVertexArray::~OpenGLVertexArray() - { - glDeleteVertexArrays(1, &m_renderer_id); - } - - auto OpenGLVertexArray::bind() const -> void - { - glBindVertexArray(m_renderer_id); - } - - auto OpenGLVertexArray::unbind() const -> void - { - glBindVertexArray(0); - } - - auto OpenGLVertexArray::add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) -> void - { - glBindVertexArray(m_renderer_id); - vertex_buffer->bind(); - - const auto& layout = vertex_buffer->get_layout(); - for (const auto& element : layout.get_elements()) - { - glEnableVertexAttribArray(m_vertex_buffer_index); - glVertexAttribPointer(m_vertex_buffer_index, - element.count, - element.type, - element.normalized ? GL_TRUE : GL_FALSE, - layout.get_stride(), - reinterpret_cast<const void*>(static_cast<uintptr_t>(element.offset))); - m_vertex_buffer_index++; - } - - m_vertex_buffers.push_back(vertex_buffer); - } - - auto OpenGLVertexArray::set_index_buffer(const Ref<IndexBuffer>& index_buffer) -> void - { - glBindVertexArray(m_renderer_id); - index_buffer->bind(); - m_index_buffer = index_buffer; - } -}; |
