aboutsummaryrefslogtreecommitdiff
path: root/src/Rendering/VertexArray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rendering/VertexArray.cpp')
-rw-r--r--src/Rendering/VertexArray.cpp28
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;
+ }
+ }
+};