BlockGame/gl/VertexBuffer.cpp

26 lines
507 B
C++
Raw Normal View History

2022-02-05 20:44:31 +00:00
//
// 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);
}