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
4
IndexBuffer::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
14
IndexBuffer::~IndexBuffer
()
15
{
16
GLCall
(glDeleteBuffers(1, &
m_RendererID
));
17
}
18
19
void
IndexBuffer::Bind
()
const
20
{
21
GLCall
(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
m_RendererID
));
22
}
23
24
void
IndexBuffer::Unbind
()
const
25
{
26
GLCall
(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
27
}
IndexBuffer.h
Renderer.h
GLCall
#define GLCall(x)
Definition
Renderer.h:12
ASSERT
#define ASSERT(x)
Definition
Renderer.h:9
IndexBuffer::~IndexBuffer
~IndexBuffer()
Definition
IndexBuffer.cpp:14
IndexBuffer::Unbind
void Unbind() const
Definition
IndexBuffer.cpp:24
IndexBuffer::m_RendererID
unsigned int m_RendererID
Definition
IndexBuffer.h:5
IndexBuffer::IndexBuffer
IndexBuffer(const unsigned int *data, unsigned int count)
Definition
IndexBuffer.cpp:4
IndexBuffer::Bind
void Bind() const
Definition
IndexBuffer.cpp:19
src
renderer
IndexBuffer.cpp
Generated by
1.10.0