diff options
| author | hachem <im@hachem.wtf> | 2025-08-12 18:12:37 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-12 18:12:37 +0200 |
| commit | a2ec7dabd48a70ea69623406ddd0f8f97af403c8 (patch) | |
| tree | 52d71b51753b88473607f5e97f8bc15bdb5ad7d3 /src/Rendering/VertexArray.cpp | |
| parent | 16dff443789c7f1461b46ce52966972ae14c042b (diff) | |
[add]: Start of a basic rendering backend
Diffstat (limited to 'src/Rendering/VertexArray.cpp')
| -rw-r--r-- | src/Rendering/VertexArray.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Rendering/VertexArray.cpp b/src/Rendering/VertexArray.cpp new file mode 100644 index 0000000..87db8fb --- /dev/null +++ b/src/Rendering/VertexArray.cpp @@ -0,0 +1,28 @@ +#include "VertexArray.h" +#include "Renderer.h" +#include "Platform/OpenGL/OpenGLVertexArray.h" + +namespace Donut +{ + uint32_t VertexBufferElement::GetSizeOfType(uint32_t type) + { + switch (type) + { + case 0x1406: return 4; // GL_FLOAT + case 0x1405: return 4; // GL_UNSIGNED_INT + case 0x1401: return 1; // GL_UNSIGNED_BYTE + default: return 0; + } + } + + VertexArray* VertexArray::Create() + { + switch (Renderer::GetAPI()) + { + case RendererAPI::API::OpenGL: + return new OpenGLVertexArray(); + default: + return nullptr; + } + } +}; |
