mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-01-25 07:34:16 +00:00
fix(vbo.cpp): add core namespace to functions
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
VBO::VBO(const void *data, std::size_t size)
|
core::VBO::VBO(const void *data, std::size_t size)
|
||||||
{
|
{
|
||||||
// Generate a unique OpenGL buffer handle (ID).
|
// Generate a unique OpenGL buffer handle (ID).
|
||||||
glGenBuffers(1, &id);
|
glGenBuffers(1, &id);
|
||||||
@@ -12,20 +12,20 @@ VBO::VBO(const void *data, std::size_t size)
|
|||||||
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
VBO::~VBO()
|
core::VBO::~VBO()
|
||||||
{
|
{
|
||||||
// delete the OpenGL buffer handle
|
// delete the OpenGL buffer handle
|
||||||
glDeleteBuffers(1, &this->id);
|
glDeleteBuffers(1, &this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::bind()
|
void core::VBO::bind()
|
||||||
{
|
{
|
||||||
// Bind this buffer to the GL_ARRAY_BUFFER target.
|
// Bind this buffer to the GL_ARRAY_BUFFER target.
|
||||||
// GL_ARRAY_BUFFER tells opengl this buffer contains vertices
|
// GL_ARRAY_BUFFER tells opengl this buffer contains vertices
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, this->id);
|
glBindBuffer(GL_ARRAY_BUFFER, this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::unbind()
|
void core::VBO::unbind()
|
||||||
{
|
{
|
||||||
// bind the buffer to NULL handle (remove old id)
|
// bind the buffer to NULL handle (remove old id)
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user