mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-01-10 07:03:13 +01:00
33 lines
578 B
C++
33 lines
578 B
C++
|
//
|
||
|
// Created by FlaXxy on 21.05.2018.
|
||
|
//
|
||
|
|
||
|
#include "./buffer.hpp"
|
||
|
|
||
|
namespace MM::OpenGL {
|
||
|
|
||
|
Buffer::Buffer(const void* data, std::size_t size, GLenum usage) : _size(size) {
|
||
|
glGenBuffers(1, &_handle);
|
||
|
glBindBuffer(GL_ARRAY_BUFFER, _handle);
|
||
|
glBufferData(GL_ARRAY_BUFFER, size, data, usage);
|
||
|
}
|
||
|
|
||
|
Buffer::~Buffer(void) {
|
||
|
glDeleteBuffers(1,&_handle);
|
||
|
}
|
||
|
|
||
|
void Buffer::bind(GLenum target) const {
|
||
|
glBindBuffer(target, _handle);
|
||
|
}
|
||
|
|
||
|
void Buffer::unbind(GLenum target) const {
|
||
|
glBindBuffer(target, 0);
|
||
|
}
|
||
|
|
||
|
std::size_t Buffer::getSize(void) const {
|
||
|
return _size;
|
||
|
}
|
||
|
|
||
|
} // MM::OpenGL
|
||
|
|