gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
ResourceManager.h
Go to the documentation of this file.
1 #ifndef __ResourceManager_h
2 #define __ResourceManager_h
3 
4 
5 //******************************************************************************
6 // Include
7 //******************************************************************************
8 #include <vector>
9 
10 #ifndef __Shader_h
11 #include <gVirtualXRay/Shader.h>
12 #endif
13 
14 #ifndef __OpenGL2VBO_h
16 #endif
17 
18 #ifndef __OpenGL3VBO_h
20 #endif
21 
22 #ifndef __Context_h
23 #include <gVirtualXRay/Context.h>
24 #endif
25 
26 
27 //******************************************************************************
28 // namespace
29 //******************************************************************************
30 //using namespace gVirtualXRay;
31 
32 
33 class FramebufferObject;
34 
35 
36 //******************************************************************************
37 // Namespace
38 //******************************************************************************
39 namespace gVirtualXRay {
40 
41 
43 {
44  public:
46  {
47  static ResourceManager instance; // Guaranteed to be destroyed.
48  // Instantiated on first use.
49  return instance;
50  }
51 
52  ResourceManager(ResourceManager const&) = delete;
53  void operator=(ResourceManager const&) = delete;
54 
55  void releaseResources();
56 
57  void addShader(Shader* apShader);
58  void addFBO(FramebufferObject* apFBO);
59  void addVBO(OpenGL2VBO* apVBO);
60  void addVBO(OpenGL3VBO* apVBO);
61 
62  void destroyAndRemoveShader(Shader* apShader);
64  void destroyAndRemoveVBO(OpenGL2VBO* apVBO);
65  void destroyAndRemoveVBO(OpenGL3VBO* apVBO);
66 
67  void setGraphicsContext(Context* apContext);
70 
71  private:
73 
74  std::vector<Shader*> m_p_shader_set;
75 
76  std::vector<FramebufferObject*> m_p_FBO_set;
77 
78  std::vector<OpenGL2VBO*> m_p_gl2_vbo;
79  std::vector<OpenGL3VBO*> m_p_gl3_vbo;
80 
81  Context* m_p_context;
82 };
83 };
84 
85 #endif
OpenGL2VBO is a class to handle a vertex buffer object (VBO) in OpenGL 2.x.
Definition: OpenGL2VBO.h:91
Class to handle vertex buffer objects (VBOs) in OpenGL 3.x or 4.x.
Class to handle GLSL shaders.
OpenGL3VBO is a class to handle a vertex buffer object (VBO) in OpenGL 3.x or 4.x.
Definition: OpenGL3VBO.h:92
void addShader(Shader *apShader)
void addVBO(OpenGL2VBO *apVBO)
void setGraphicsContext(Context *apContext)
void operator=(ResourceManager const &)=delete
void destroyAndRemoveShader(Shader *apShader)
Shader is a class to handle shaders written in GLSL.
Definition: Shader.h:87
void destroyAndRemoveFBO(FramebufferObject *apFBO)
Context is a class to manage an OpenGL or Vulkan context.
Definition: Context.h:111
void destroyAndRemoveVBO(OpenGL2VBO *apVBO)
Class to handle vertex buffer objects (VBOs) in OpenGL 2.x.
Create an OpenGL context using EGL or GLFW.
void addFBO(FramebufferObject *apFBO)
static ResourceManager & getInstance()