summaryrefslogtreecommitdiffstats
path: root/Project/VertexBuffer.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
commitab30228b1a57053323363674fa7f137c0329a180 (patch)
tree50849a3680d61a2428665cc1035f1f4215870acb /Project/VertexBuffer.cpp
parent6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (diff)
downloadPSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.gz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.xz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.zip
Voltage heat map implemented
Voltage heat map implemented using modern OpenGL =) New external library required: -GLEW -GLFW -GLM (incorporeted at the source) Old memory leaks fixed =)
Diffstat (limited to 'Project/VertexBuffer.cpp')
-rw-r--r--Project/VertexBuffer.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Project/VertexBuffer.cpp b/Project/VertexBuffer.cpp
new file mode 100644
index 0000000..cd8562c
--- /dev/null
+++ b/Project/VertexBuffer.cpp
@@ -0,0 +1,30 @@
+#include "VertexBuffer.h"
+
+#include "Renderer.h"
+
+VertexBuffer::VertexBuffer(const void* data, unsigned int size, unsigned int usage)
+{
+ GLCall(glGenBuffers(1, &m_rendererID));
+ GLCall(glBindBuffer(GL_ARRAY_BUFFER, m_rendererID));
+ GLCall(glBufferData(GL_ARRAY_BUFFER, size, data, usage));
+}
+
+VertexBuffer::~VertexBuffer()
+{
+ GLCall(glDeleteBuffers(1, &m_rendererID));
+}
+
+void VertexBuffer::SetSubData(const void* data, const unsigned int& size) const
+{
+ GLCall(glBufferSubData(GL_ARRAY_BUFFER, 0, size, data));
+}
+
+void VertexBuffer::Bind() const
+{
+ GLCall(glBindBuffer(GL_ARRAY_BUFFER, m_rendererID));
+}
+
+void VertexBuffer::Unbind() const
+{
+ GLCall(glBindBuffer(GL_ARRAY_BUFFER, 0));
+}