blob: aa6be9b0f593bd082ae892d4ac321818a34abdff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "CustomVertexLayout.h"
namespace VertexLayout
{
void SetupCustomVertexLayout(CustomVertexLayout& info)
{
glBindBuffer(GL_ARRAY_BUFFER, info.buffer);
for (int i = 0; i < info.attributes.size(); ++i)
{
VertexAttributeDescriptor& attr = info.attributes[i];
glEnableVertexAttribArray(i);
int numCompo = attr.componentNum;
GLenum compoType = VertexAttribute::ConvertAttrFormatToGLFormat(attr.componentFormat);
bool normalized = attr.normalize;
uint stride = attr.stride;
const void* pointer = attr.pointer;
glVertexAttribPointer(i, numCompo, compoType, normalized ? GL_TRUE : GL_FALSE, stride, pointer);
}
}
}
|