cangine
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
cangine::VAO Class Reference

Wraps an OpenGL Vertex Array Object. More...

#include <vao.hpp>

Public Member Functions

 VAO ()
 Generates the underlying OpenGL vertex array object.
 
 ~VAO ()
 Deletes the underlying OpenGL vertex array object.
 
void linkAttrib (const VBO &vbo, unsigned int layoutLocation, int count, int stride, uintptr_t offset)
 Links a vertex attribute from a VBO into this VAO.
 
void bind () const
 Binds this vertex array object.
 
void unbind () const
 Unbinds the current vertex array object.
 

Private Attributes

unsigned int ID
 OpenGL vertex array object handle.
 

Detailed Description

Wraps an OpenGL Vertex Array Object.

Records the vertex attribute layout (which VBO feeds which shader input and how) so it can be rebound with a single call.

Constructor & Destructor Documentation

◆ VAO()

cangine::VAO::VAO ( )

Generates the underlying OpenGL vertex array object.

◆ ~VAO()

cangine::VAO::~VAO ( )

Deletes the underlying OpenGL vertex array object.

Member Function Documentation

◆ bind()

void cangine::VAO::bind ( ) const

Binds this vertex array object.

◆ linkAttrib()

void cangine::VAO::linkAttrib ( const VBO &  vbo,
unsigned int  layoutLocation,
int  count,
int  stride,
uintptr_t  offset 
)

Links a vertex attribute from a VBO into this VAO.

Parameters
vboBuffer supplying the attribute data.
layoutLocationShader attribute location index.
countNumber of components per attribute (e.g. 3 for a vec3).
strideByte offset between consecutive attributes.
offsetByte offset of the first component within the vertex.

◆ unbind()

void cangine::VAO::unbind ( ) const

Unbinds the current vertex array object.

Member Data Documentation

◆ ID

unsigned int cangine::VAO::ID
private

OpenGL vertex array object handle.


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