|
|
@ -115,6 +115,17 @@ namespace Inferno { |
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------
|
|
|
|
// -----------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VertexBuffer::VertexBuffer(size_t size) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
glGenBuffers(1, &m_id); |
|
|
|
|
|
|
|
this->bind(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reserve data on the GPU
|
|
|
|
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, size, nullptr, GL_DYNAMIC_DRAW); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->unbind(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
VertexBuffer::VertexBuffer(float* vertices, size_t size) |
|
|
|
VertexBuffer::VertexBuffer(float* vertices, size_t size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
glGenBuffers(1, &m_id); |
|
|
|
glGenBuffers(1, &m_id); |
|
|
@ -141,6 +152,16 @@ namespace Inferno { |
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); |
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VertexBuffer::uploadData(const void* data, uint32_t size) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->bind(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Upload data to the GPU
|
|
|
|
|
|
|
|
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->unbind(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------
|
|
|
|
// -----------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
IndexBuffer::IndexBuffer(uint32_t* indices, size_t size) : |
|
|
|
IndexBuffer::IndexBuffer(uint32_t* indices, size_t size) : |
|
|
|