RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
Loading...
Searching...
No Matches
IndexBuffer.cpp
Go to the documentation of this file.
1#include "IndexBuffer.h"
2#include "Renderer.h"
3
4IndexBuffer::IndexBuffer(const unsigned int* data, unsigned int count) :
5 m_Count(count)
6{
7 ASSERT(sizeof(unsigned int) == sizeof(GLuint));
8
9 GLCall(glGenBuffers(1, &m_RendererID));
10 GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID));
11 GLCall(glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(unsigned int), data, GL_STATIC_DRAW));
12}
13
15{
16 GLCall(glDeleteBuffers(1, &m_RendererID));
17}
18
20{
21 GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID));
22}
23
25{
26 GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
27}
#define GLCall(x)
Definition Renderer.h:12
#define ASSERT(x)
Definition Renderer.h:9
void Unbind() const
unsigned int m_RendererID
Definition IndexBuffer.h:5
IndexBuffer(const unsigned int *data, unsigned int count)
void Bind() const