mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 19:32:49 +01:00
21 lines
493 B
C++
21 lines
493 B
C++
#include <gl/GeometryBuffer.hpp>
|
|
|
|
GeometryBuffer::GeometryBuffer() : vbo(0), num(0) {
|
|
}
|
|
|
|
GeometryBuffer::~GeometryBuffer() {
|
|
if (vbo != 0) {
|
|
glDeleteBuffers(1, &vbo);
|
|
}
|
|
}
|
|
|
|
void GeometryBuffer::uploadVertices(GLsizei num, GLsizeiptr size,
|
|
const GLvoid* mem) {
|
|
if (vbo == 0) {
|
|
glGenBuffers(1, &vbo);
|
|
}
|
|
this->num = num;
|
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
|
glBufferData(GL_ARRAY_BUFFER, size, mem, GL_STATIC_DRAW);
|
|
}
|