RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
Loading...
Searching...
No Matches
IndexBuffer Class Reference

#include <IndexBuffer.h>

Collaboration diagram for IndexBuffer:

Public Member Functions

 IndexBuffer (const unsigned int *data, unsigned int count)
 
 ~IndexBuffer ()
 
void Bind () const
 
void Unbind () const
 
unsigned int GetCount () const
 

Private Attributes

unsigned int m_RendererID
 
unsigned int m_Count
 

Detailed Description

Definition at line 2 of file IndexBuffer.h.

Constructor & Destructor Documentation

◆ IndexBuffer()

IndexBuffer::IndexBuffer ( const unsigned int * data,
unsigned int count )

Definition at line 4 of file IndexBuffer.cpp.

4 :
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}
#define GLCall(x)
Definition Renderer.h:12
#define ASSERT(x)
Definition Renderer.h:9
unsigned int m_Count
Definition IndexBuffer.h:6
unsigned int m_RendererID
Definition IndexBuffer.h:5

◆ ~IndexBuffer()

IndexBuffer::~IndexBuffer ( )

Definition at line 14 of file IndexBuffer.cpp.

15{
16 GLCall(glDeleteBuffers(1, &m_RendererID));
17}

Member Function Documentation

◆ Bind()

void IndexBuffer::Bind ( ) const

Definition at line 19 of file IndexBuffer.cpp.

20{
21 GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID));
22}

◆ GetCount()

unsigned int IndexBuffer::GetCount ( ) const
inline

Definition at line 15 of file IndexBuffer.h.

16 {
17 return m_Count;
18 };

◆ Unbind()

void IndexBuffer::Unbind ( ) const

Definition at line 24 of file IndexBuffer.cpp.

25{
26 GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
27}

Member Data Documentation

◆ m_Count

unsigned int IndexBuffer::m_Count
private

Definition at line 6 of file IndexBuffer.h.

◆ m_RendererID

unsigned int IndexBuffer::m_RendererID
private

Definition at line 5 of file IndexBuffer.h.


The documentation for this class was generated from the following files: