BARE2D
BARE2D::VAO Class Reference

A wrapper class for OpenGL's VAO, as well as its associated VBO and attributes. More...

#include <VAO.hpp>

+ Collaboration diagram for BARE2D::VAO:

Public Member Functions

 VAO ()
 
 ~VAO ()
 
void init ()
 Initializes the necessary components, combining the VBO and VAO. More...
 
void destroy ()
 Releases necessary memory. More...
 
void bind ()
 Binds this vertex array object. More...
 
void bindVBO ()
 Binds the VAO's VBO. More...
 
void unbind ()
 Unbinds the vao. More...
 
void unbindVBO ()
 Unbinds this VAO's VBO. More...
 
void addVertexAttribute (GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *data)
 Wrapper for glVertexAttribPointer - Adds an attribute to the VBO - each vertex data slot will gain some attribute. More...
 

Private Attributes

unsigned int m_numAttributes
 
GLuint m_vaoHandle
 
GLuint m_vboHandle
 

Detailed Description

A wrapper class for OpenGL's VAO, as well as its associated VBO and attributes.

Definition at line 11 of file VAO.hpp.

Constructor & Destructor Documentation

◆ VAO()

BARE2D::VAO::VAO ( )

Definition at line 5 of file VAO.cpp.

References m_numAttributes.

◆ ~VAO()

BARE2D::VAO::~VAO ( )

Definition at line 10 of file VAO.cpp.

Member Function Documentation

◆ addVertexAttribute()

void BARE2D::VAO::addVertexAttribute ( GLint  size,
GLenum  type,
GLboolean  normalized,
GLsizei  stride,
const void *  data 
)

Wrapper for glVertexAttribPointer - Adds an attribute to the VBO - each vertex data slot will gain some attribute.

Parameters
sizeNumber of components per attribute (1-4)
typeType of data - GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, etc. See docs
normalizedShould the data be normalized or converted directly? (GL_TRUE/GL_FALSE)
strideSpecifies the byte offset between consecutive generic vertex attributes. If stride is 0, the generic vertex attributes are understood to be tightly packed in the array. The initial value is 0.
dataSpecifies a offset of the first component of the first generic vertex attribute in the array in the data store of the buffer currently bound to the GL_ARRAY_BUFFER target. The initial value is 0.

Definition at line 66 of file VAO.cpp.

References bind(), bindVBO(), m_numAttributes, and unbind().

Referenced by BARE2D::BasicRenderer::init(), BARE2D::FBORenderer::init(), BARE2D::TexturelessRenderer::init(), and BARE2D::DebugRenderer::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bind()

void BARE2D::VAO::bind ( )

Binds this vertex array object.

Definition at line 48 of file VAO.cpp.

References m_vaoHandle.

Referenced by addVertexAttribute(), init(), BARE2D::BumpyRenderer::render(), BARE2D::FBORenderer::render(), BARE2D::Renderer::render(), and BARE2D::DebugRenderer::render().

+ Here is the caller graph for this function:

◆ bindVBO()

◆ destroy()

void BARE2D::VAO::destroy ( )

Releases necessary memory.

Definition at line 33 of file VAO.cpp.

References m_numAttributes, m_vaoHandle, m_vboHandle, and unbind().

Referenced by BARE2D::Renderer::destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void BARE2D::VAO::init ( )

Initializes the necessary components, combining the VBO and VAO.

Definition at line 14 of file VAO.cpp.

References bind(), m_vaoHandle, m_vboHandle, and unbind().

Referenced by BARE2D::Renderer::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unbind()

void BARE2D::VAO::unbind ( )

Unbinds the vao.

Definition at line 53 of file VAO.cpp.

Referenced by addVertexAttribute(), destroy(), init(), BARE2D::BumpyRenderer::render(), BARE2D::FBORenderer::render(), BARE2D::Renderer::render(), and BARE2D::DebugRenderer::render().

+ Here is the caller graph for this function:

◆ unbindVBO()

void BARE2D::VAO::unbindVBO ( )

Field Documentation

◆ m_numAttributes

unsigned int BARE2D::VAO::m_numAttributes
private

Definition at line 58 of file VAO.hpp.

Referenced by addVertexAttribute(), destroy(), and VAO().

◆ m_vaoHandle

GLuint BARE2D::VAO::m_vaoHandle
private

Definition at line 60 of file VAO.hpp.

Referenced by bind(), destroy(), and init().

◆ m_vboHandle

GLuint BARE2D::VAO::m_vboHandle
private

Definition at line 61 of file VAO.hpp.

Referenced by bindVBO(), destroy(), and init().


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