NGL  6.5
The NCCA Graphics Library
VAOFactory.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef VAOFACTORY_H_
18 #define VAOFACTORY_H_
19 
20 #include "Types.h"
21 #include "AbstractVAO.h"
22 #include <unordered_map>
23 #include <string>
24 #include <functional>
25 namespace ngl
26 {
27 //----------------------------------------------------------------------------------------------------------------------
34 //----------------------------------------------------------------------------------------------------------------------
35 
36 
37 
38 
40 {
41  public :
42  //----------------------------------------------------------------------------------------------------------------------
46  //----------------------------------------------------------------------------------------------------------------------
47  static void registerVAOCreator(const std::string &_type, std::function<AbstractVAO *(GLenum _mode)> _cb);
48  //----------------------------------------------------------------------------------------------------------------------
51  //----------------------------------------------------------------------------------------------------------------------
52  static void unregisterVAOCreator(const std::string &_type);
53  //----------------------------------------------------------------------------------------------------------------------
58  //----------------------------------------------------------------------------------------------------------------------
59  static AbstractVAO *createVAO(const std::string &_type, GLenum _mode=GL_TRIANGLES);
60  //----------------------------------------------------------------------------------------------------------------------
62  //----------------------------------------------------------------------------------------------------------------------
63  static void listCreators();
64  private :
65  //----------------------------------------------------------------------------------------------------------------------
66  //----------------------------------------------------------------------------------------------------------------------
67  static std::unordered_map<std::string, std::function<AbstractVAO *(GLenum _mode)>> m_vaoCreators;
68 
69 };
70 
71 
72 }
73 
74 #endif
main definition of types and namespace
#define NGL_DLLEXPORT
Definition: Types.h:65
#define GL_TRIANGLES
Definition: glew.h:330
extensible factory to allow different types of VAO&#39;s to be generated for NGL two default ones will be...
Definition: VAOFactory.h:39
unsigned int GLenum
Definition: glew.h:278
implementation files for RibExport class
Definition: AABB.cpp:22
base class for all VAO from the VAOFactory this defines the base class type with simple draw / bind b...
Definition: AbstractVAO.h:34
static std::unordered_map< std::string, std::function< AbstractVAO *(GLenum _mode)> > m_vaoCreators
Definition: VAOFactory.h:67
GLsizei const GLchar *const * string
Definition: glew.h:1847