15 Buffer* Buffer::current =
nullptr;
17 Buffer::Buffer(
void) {
18 glGenBuffers(1, &handle);
21 Buffer::~Buffer(
void) {
22 glDeleteBuffers(1, &handle);
25 if (Buffer::current ==
this) {
26 Buffer::current =
nullptr;
30 GLuint Buffer::getHandle() {
36 if (Buffer::current ==
this) {
42 Buffer::current =
this;
69 void Buffer::uploadSubData(
BufferTarget target,
long offset,
long size,
float* data) {
70 glBufferSubData(
to_GLenum(target), offset, size, data);
73 void Buffer::uploadSubData(
BufferTarget target,
long offset,
long size, std::vector<float> data) {
74 glBufferSubData(
to_GLenum(target), offset, size, data.data());
77 void Buffer::uploadSubData(
BufferTarget target,
long offset,
long size, std::vector<glm::vec2> data) {
78 glBufferSubData(
to_GLenum(target), offset, size, data.data());
81 void Buffer::uploadSubData(
BufferTarget target,
long offset,
long size, std::vector<glm::vec3> data) {
82 glBufferSubData(
to_GLenum(target), offset, size, data.data());
85 void Buffer::uploadSubData(
BufferTarget target,
long offset,
long size, std::vector<glm::vec4> data) {
86 glBufferSubData(
to_GLenum(target), offset, size, data.data());
BufferUsage
This enum wraps the buffer object's usages.
MapRangeAccess
This enum wraps the buffer object's map range access bits.
GLenum to_GLenum(E e)
Gets the GLenum value from an enum class.
Generic namespace for the SimpleGL framework.
MapAccess
This enum wraps the buffer object's map accesses.
GLbitfield to_GLbitfield(E e)
Gets the GLbitfield value from an enum class.
BufferTarget
This enum wraps the buffer object's targets.