From 51ced5a191078ce4ef08d57e343e91db007f556f Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Oct 2021 19:30:06 +0800 Subject: *misc --- Runtime/Graphics/GPUDataBuffers.cpp | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Runtime/Graphics/GPUDataBuffers.cpp (limited to 'Runtime/Graphics/GPUDataBuffers.cpp') diff --git a/Runtime/Graphics/GPUDataBuffers.cpp b/Runtime/Graphics/GPUDataBuffers.cpp new file mode 100644 index 0000000..9e8df9f --- /dev/null +++ b/Runtime/Graphics/GPUDataBuffers.cpp @@ -0,0 +1,42 @@ +#include "GPUDataBuffers.h" + +void foo() +{ + GPUDataBuffer buf = GPUDataBuffer(GL_ARRAY_BUFFER, GL_STATIC_DRAW); + int n = buf.GetComponentSize(); +} + +VBO::VBO() + : GPUDataBuffer(GL_ARRAY_BUFFER, GL_STATIC_DRAW) +{ +} +VBO::VBO(GLenum usage) + : GPUDataBuffer(GL_ARRAY_BUFFER, usage) +{ +} + +VBO::~VBO() +{ +} + +void VBO::AddVertexAttribute(int index, int numOfComps, int stride) +{ + VertexAttributeDescriptor attribute = VertexAttributeDescriptor(); + attribute.index = index; + attribute.numOfComponents = numOfComps; + attribute.stride = stride; + m_Layout.attributes.push_back(attribute); +} +void VBO::AddVertexAttribute(VertexAttributeDescriptor& attribute) +{ + m_Layout.attributes.push_back(attribute); +} +int VBO::GetVertexAttributesCount() +{ + return m_Layout.attributes.size(); +} +void VBO::ClearVertexAttribute() +{ + m_Layout.attributes.clear(); +} + -- cgit v1.1-26-g67d0