summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/GPUDataBuffers.cpp
blob: 9e8df9f441e720d9fa7f90b7f8978ab6f9bd0050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "GPUDataBuffers.h"

void foo()
{
    GPUDataBuffer<float> buf = GPUDataBuffer<float>(GL_ARRAY_BUFFER, GL_STATIC_DRAW);
    int n = buf.GetComponentSize();
}

VBO::VBO()
    : GPUDataBuffer<float>(GL_ARRAY_BUFFER, GL_STATIC_DRAW)
{
}
VBO::VBO(GLenum usage)
    : GPUDataBuffer<float>(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();
}