GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HdlGeBO.hpp
Go to the documentation of this file.
1 /* ************************************************************************************************************* */
2 /* */
3 /* GLIP-LIB */
4 /* OpenGL Image Processing LIBrary */
5 /* */
6 /* Author : R. Kerviche */
7 /* LICENSE : MIT License */
8 /* Website : glip-lib.net */
9 /* */
10 /* File : HdlGeBO.hpp */
11 /* Original Date : August 7th 2010 */
12 /* */
13 /* Description : OpenGL Pixel Buffer Object Handle */
14 /* */
15 /* ************************************************************************************************************* */
16 
24 #ifndef __HDLGEBO_INCLUDE__
25 #define __HDLGEBO_INCLUDE__
26 
27  // GL include
28  #include "Core/LibTools.hpp"
29  #include "Core/OglInclude.hpp"
30 
31  namespace Glip
32  {
33  namespace CoreGL
34  {
35  // Buffer Object Handle
40  class GLIP_API HdlGeBO
41  {
42  private :
43  // Data
44  GLuint bufferId;
45  GLenum buildTarget,
46  buildUsage;
47  GLsizeiptr size;
48  static bool binding[4];
49  static bool mapping[4]; // VS/CL will complain if these two are not splitted.
50 
51  // No copy constructor
52  HdlGeBO(const HdlGeBO&);
53 
54  // Tools
55  static int getIDTarget(GLenum target);
56 
57  public :
58  // Tools
59  HdlGeBO(GLsizeiptr _size, GLenum infoTarget, GLenum infoUsage);
60  HdlGeBO(GLuint id, GLsizeiptr _size, GLenum infoTarget, GLenum infoUsage);
61  ~HdlGeBO(void);
62 
63  GLsizeiptr getSize(void);
64  GLuint getID(void);
65  GLenum getTarget(void);
66  GLenum getUsage(void);
67  void bind(GLenum target = GL_NONE);
68  void* map(GLenum access = GL_NONE, GLenum target = GL_NONE);
69  void write(const void* data);
70  void subWrite(const void* data, GLsizeiptr size, GLintptr offset);
71 
72  // Static tools
73  static void unbind(GLenum target);
74  static void unmap(GLenum target);
75  static bool isBound(GLenum target);
76  static bool isMapped(GLenum target);
77  };
78 
79  /*
80  TARGETS List
81  GL_ARRAY_BUFFER_ARB
82  GL_ELEMENT_ARRAY_BUFFER_ARB
83  GL_PIXEL_UNPACK_BUFFER_ARB
84  GL_PIXEL_PACK_BUFFER_ARB
85 
86  USAGE List
87  GL_STATIC_DRAW_ARB
88  GL_STATIC_READ_ARB
89  GL_STATIC_COPY_ARB
90  GL_DYNAMIC_DRAW_ARB
91  GL_DYNAMIC_READ_ARB
92  GL_DYNAMIC_COPY_ARB
93  GL_STREAM_DRAW_ARB
94  GL_STREAM_READ_ARB
95  GL_STREAM_COPY_ARB
96 
97  ACCESS LIST
98  GL_READ_ONLY_ARB
99  GL_WRITE_ONLY_ARB
100  GL_READ_WRITE_ARB
101  */
102  }
103  }
104 
105 #endif
106 
Specific defines for the API structure.
Definition: Component.hpp:32
Object handle for OpenGL Buffer Object (VBO, PBO, VAO, ...).
Definition: HdlGeBO.hpp:40
OpenGL includes and tools.