NGL  6.5
The NCCA Graphics Library
ngl::VAOFactory Class Reference

extensible factory to allow different types of VAO's to be generated for NGL two default ones will be created but allows the user to do more complex stuff if required More...

#include <VAOFactory.h>

+ Collaboration diagram for ngl::VAOFactory:

Static Public Member Functions

static void registerVAOCreator (const std::string &_type, std::function< AbstractVAO *(GLenum _mode)> _cb)
 Add a new vao creator to our factory. More...
 
static void unregisterVAOCreator (const std::string &_type)
 Remove an existing vao creator from the map. More...
 
static AbstractVAOcreateVAO (const std::string &_type, GLenum _mode=GL_TRIANGLES)
 
static void listCreators ()
 debug function to list all creators More...
 

Static Private Attributes

static std::unordered_map< std::string, std::function< AbstractVAO *(GLenum _mode)> > m_vaoCreators
 

Detailed Description

extensible factory to allow different types of VAO's to be generated for NGL two default ones will be created but allows the user to do more complex stuff if required

Author
Jonathan Macey
Version
1.0
Date
6/4/16

Definition at line 39 of file VAOFactory.h.

Member Function Documentation

AbstractVAO * ngl::VAOFactory::createVAO ( const std::string _type,
GLenum  _mode = GL_TRIANGLES 
)
static

Create an instance of a named VAO from a creator

Parameters
_typethe name of the creator to use from our factory
_modethe initial mode to create (i.e. GL_TRIANGLES etc)
Returns
AbstractAVO *

Definition at line 19 of file VAOFactory.cpp.

References m_vaoCreators.

+ Here is the caller graph for this function:

void ngl::VAOFactory::listCreators ( )
static

debug function to list all creators

Definition at line 32 of file VAOFactory.cpp.

References m_vaoCreators.

void ngl::VAOFactory::registerVAOCreator ( const std::string _type,
std::function< AbstractVAO *(GLenum _mode)>  _cb 
)
static

Add a new vao creator to our factory.

Parameters
_typethe name of the creator function registered
_cbthe creator function must pass in a GLenum for the type to create and return an AbstractVAO

Definition at line 9 of file VAOFactory.cpp.

References m_vaoCreators.

+ Here is the caller graph for this function:

void ngl::VAOFactory::unregisterVAOCreator ( const std::string _type)
static

Remove an existing vao creator from the map.

Parameters
_typethe name of the creator to remove

Definition at line 14 of file VAOFactory.cpp.

References m_vaoCreators.

Member Data Documentation

std::unordered_map< std::string, std::function< AbstractVAO *(GLenum _mode)> > ngl::VAOFactory::m_vaoCreators
staticprivate

Definition at line 67 of file VAOFactory.h.


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