26 lines
507 B
C++
26 lines
507 B
C++
|
//
|
||
|
// Created by lukas on 03.02.22.
|
||
|
//
|
||
|
|
||
|
#include "VertexBuffer.h"
|
||
|
|
||
|
#include <GL/gl.h>
|
||
|
|
||
|
VertexBuffer::VertexBuffer(const void* data, const unsigned size) {
|
||
|
glGenBuffers(1, &handle);
|
||
|
glBindBuffer(GL_ARRAY_BUFFER, handle);
|
||
|
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW);
|
||
|
}
|
||
|
|
||
|
VertexBuffer::~VertexBuffer() {
|
||
|
glDeleteBuffers(1, &handle);
|
||
|
}
|
||
|
|
||
|
void VertexBuffer::Bind() const {
|
||
|
glBindBuffer(GL_ARRAY_BUFFER, handle);
|
||
|
}
|
||
|
|
||
|
void VertexBuffer::UnBind() const {
|
||
|
glBindVertexArray(0);
|
||
|
}
|