diff options
| author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-07 23:12:04 -0300 |
|---|---|---|
| committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-07 23:12:04 -0300 |
| commit | ab30228b1a57053323363674fa7f137c0329a180 (patch) | |
| tree | 50849a3680d61a2428665cc1035f1f4215870acb /Project/IndexBuffer.cpp | |
| parent | 6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (diff) | |
| download | PSP.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/IndexBuffer.cpp')
| -rw-r--r-- | Project/IndexBuffer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Project/IndexBuffer.cpp b/Project/IndexBuffer.cpp new file mode 100644 index 0000000..036796a --- /dev/null +++ b/Project/IndexBuffer.cpp @@ -0,0 +1,24 @@ +#include "IndexBuffer.h" +#include "Renderer.h" + +IndexBuffer::IndexBuffer(const unsigned int* data, unsigned int count) : m_count(count) +{ + GLCall(glGenBuffers(1, &m_rendererID)); + GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_rendererID)); + GLCall(glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(unsigned int), data, GL_STATIC_DRAW)); +} + +IndexBuffer::~IndexBuffer() +{ + GLCall(glDeleteBuffers(1, &m_rendererID)); +} + +void IndexBuffer::Bind() const +{ + GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_rendererID)); +} + +void IndexBuffer::Unbind() const +{ + GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); +}
\ No newline at end of file |
