OGLplus (0.52.0) a C++ wrapper for OpenGL

buffer.hpp
Go to the documentation of this file.
1 
14 #ifndef OGLPLUS_BOUND_BUFFER_1107121519_HPP
15 #define OGLPLUS_BOUND_BUFFER_1107121519_HPP
16 
17 #include <oglplus/object/bound.hpp>
18 #include <oglplus/buffer.hpp>
19 #include <utility>
20 
21 namespace oglplus {
22 
24 
35 template <>
36 class BoundObjOps<tag::Buffer>
37 {
38 private:
40 public:
42  Target target;
43 
44  BoundObjOps(void)
45  { }
46 
47  BoundObjOps(Target init_tgt)
48  : target(init_tgt)
49  { }
50 
54  GLint GetIntParam(
55  GLenum query
56  ) const
57  {
58  return ExplicitOps::GetIntParam(
59  this->target,
60  query
61  );
62  }
63 
64 
68  bool Mapped(void) const
69  {
70  return ExplicitOps::Mapped(
71  this->target
72  );
73  }
74 
75 
79  const BoundObjOps& Resize(
80  BufferSize size,
82  ) const
83  {
84  ExplicitOps::Resize(
85  this->target,
86  size,
87  usage
88  );
89  return *this;
90  }
91 
92 
96  template <typename GLtype>
97  const BoundObjOps& Data(
98  GLsizei count,
99  const GLtype * data,
101  ) const
102  {
103  ExplicitOps::Data(
104  this->target,
105  count,
106  data,
107  usage
108  );
109  return *this;
110  }
111 
112 
116  template <typename GLtype, std::size_t Count>
117  const BoundObjOps& Data(
118  const GLtype (&data)[Count],
120  ) const
121  {
122  ExplicitOps::Data(
123  this->target,
124  data,
125  usage
126  );
127  return *this;
128  }
129 
130 
134  template <typename GLtype>
135  const BoundObjOps& Data(
136  const std::vector< GLtype > & data,
138  ) const
139  {
140  ExplicitOps::Data(
141  this->target,
142  data,
143  usage
144  );
145  return *this;
146  }
147 
148 
152  template <typename GLtype, std::size_t N>
153  const BoundObjOps& Data(
154  const std::vector< Vector< GLtype, N > > & data,
156  ) const
157  {
158  ExplicitOps::Data(
159  this->target,
160  data,
161  usage
162  );
163  return *this;
164  }
165 
166 
170  template <typename GLtype>
171  const BoundObjOps& SubData(
172  BufferSize offset,
173  GLsizei count,
174  const GLtype * data
175  ) const
176  {
177  ExplicitOps::SubData(
178  this->target,
179  offset,
180  count,
181  data
182  );
183  return *this;
184  }
185 
186 
190  template <typename GLtype, std::size_t Count>
191  const BoundObjOps& SubData(
192  BufferSize offset,
193  const GLtype (&data)[Count]
194  ) const
195  {
196  ExplicitOps::SubData(
197  this->target,
198  offset,
199  data
200  );
201  return *this;
202  }
203 
204 
208  template <typename GLtype>
209  const BoundObjOps& SubData(
210  BufferSize offset,
211  const std::vector< GLtype > & data
212  ) const
213  {
214  ExplicitOps::SubData(
215  this->target,
216  offset,
217  data
218  );
219  return *this;
220  }
221 
222 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
223 
227  template <typename GLtype>
228  const BoundObjOps& ClearData(
229  PixelDataInternalFormat internal_format,
230  PixelDataFormat format,
231  const GLtype * data
232  ) const
233  {
234  ExplicitOps::ClearData(
235  this->target,
236  internal_format,
237  format,
238  data
239  );
240  return *this;
241  }
242 #endif // GL_VERSION_4_3
243 
244 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
245 
249  template <typename GLtype>
250  const BoundObjOps& ClearSubData(
251  PixelDataInternalFormat internal_format,
252  BufferSize offset,
253  BufferSize size,
254  PixelDataFormat format,
255  const GLtype * data
256  ) const
257  {
258  ExplicitOps::ClearSubData(
259  this->target,
260  internal_format,
261  offset,
262  size,
263  format,
264  data
265  );
266  return *this;
267  }
268 #endif // GL_VERSION_4_3
269 
270 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_buffer_storage
271 
275  const BoundObjOps& Storage(
276  BufferSize size,
277  const void * data,
279  ) const
280  {
281  ExplicitOps::Storage(
282  this->target,
283  size,
284  data,
285  flags
286  );
287  return *this;
288  }
289 #endif // GL_VERSION_4_4 GL_ARB_buffer_storage
290 
291 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_buffer_storage
292 
296  bool ImmutableStorage(void) const
297  {
298  return ExplicitOps::ImmutableStorage(
299  this->target
300  );
301  }
302 #endif // GL_VERSION_4_4 GL_ARB_buffer_storage
303 
304 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_buffer_storage
305 
310  {
311  return ExplicitOps::StorageFlags(
312  this->target
313  );
314  }
315 #endif // GL_VERSION_4_4 GL_ARB_buffer_storage
316 
317 
321  GLsizei Size(void) const
322  {
323  return ExplicitOps::Size(
324  this->target
325  );
326  }
327 
328 
332  BufferUsage Usage(void) const
333  {
334  return ExplicitOps::Usage(
335  this->target
336  );
337  }
338 
339 
344  {
345  return ExplicitOps::Access(
346  this->target
347  );
348  }
349 
350 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_shader_buffer_load
351 
355  const BoundObjOps& MakeResident(
356  AccessSpecifier access
357  ) const
358  {
359  ExplicitOps::MakeResident(
360  this->target,
361  access
362  );
363  return *this;
364  }
365 #endif // GL_NV_shader_buffer_load
366 
367 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_shader_buffer_load
368 
372  const BoundObjOps& MakeNonResident(void) const
373  {
374  ExplicitOps::MakeNonResident(
375  this->target
376  );
377  return *this;
378  }
379 #endif // GL_NV_shader_buffer_load
380 
381 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_shader_buffer_load
382 
386  BufferGPUAddress GPUAddress(void) const
387  {
388  return ExplicitOps::GPUAddress(
389  this->target
390  );
391  }
392 #endif // GL_NV_shader_buffer_load
393 
394 
395 }; // class BoundObjOps
396 
397 } // namespace oglplus
398 
399 #endif // include guard
AccessSpecifier typedef AccessSpecifier Access
Alternate name for AccessSpecifier.
Definition: access_specifier.hpp:35
const BoundObjOps & ClearSubData(PixelDataInternalFormat internal_format, BufferSize offset, BufferSize size, PixelDataFormat format, const GLtype *data) const
Definition: buffer.hpp:250
GLsizei Size(void) const
Definition: buffer.hpp:321
const BoundObjOps & MakeNonResident(void) const
Definition: buffer.hpp:372
PixelDataInternalFormat
OpenGL pixel data internal format enumeration.
Definition: pixel_data.hpp:79
const BoundObjOps & Storage(BufferSize size, const void *data, Bitfield< BufferStorageBit > flags) const
Definition: buffer.hpp:275
const BoundObjOps & SubData(BufferSize offset, const std::vector< GLtype > &data) const
Definition: buffer.hpp:209
This class represents the size of a GPU buffer in bytes.
Definition: buffer_size.hpp:22
BufferUsage
Buffer usage enumeration.
Definition: buffer_usage.hpp:24
This template serves as a wrapper for OpenGL bitfields.
Definition: bitfield.hpp:56
bool ImmutableStorage(void) const
Definition: buffer.hpp:296
const BoundObjOps & Data(GLsizei count, const GLtype *data, BufferUsage usage=BufferUsage::StaticDraw) const
Definition: buffer.hpp:97
const BoundObjOps & SubData(BufferSize offset, const GLtype(&data)[Count]) const
Definition: buffer.hpp:191
AccessSpecifier
Enumeration of access type specifiers.
Definition: access_specifier.hpp:27
BufferUsage Usage(void) const
Definition: buffer.hpp:332
PixelDataFormat
OpenGL pixel data format enumeration.
Definition: pixel_data.hpp:50
const BoundObjOps & SubData(BufferSize offset, GLsizei count, const GLtype *data) const
Definition: buffer.hpp:171
const BoundObjOps & Data(const GLtype(&data)[Count], BufferUsage usage=BufferUsage::StaticDraw) const
Definition: buffer.hpp:117
const BoundObjOps & Data(const std::vector< Vector< GLtype, N > > &data, BufferUsage usage=BufferUsage::StaticDraw) const
Definition: buffer.hpp:153
Bitfield< BufferStorageBit > StorageFlags(void) const
Definition: buffer.hpp:309
const BoundObjOps & ClearData(PixelDataInternalFormat internal_format, PixelDataFormat format, const GLtype *data) const
Definition: buffer.hpp:228
const BoundObjOps & MakeResident(AccessSpecifier access) const
Definition: buffer.hpp:355
BufferGPUAddress GPUAddress(void) const
Definition: buffer.hpp:386
const BoundObjOps & Resize(BufferSize size, BufferUsage usage=BufferUsage::StaticDraw) const
Definition: buffer.hpp:79
Operations on currently bound objects.
Object< BufferOps > Buffer
An oglplus_object encapsulating the OpenGL buffer functionality.
Definition: buffer.hpp:1056
Buffer wrappers.
bool Mapped(void) const
Definition: buffer.hpp:68
GLint GetIntParam(GLenum query) const
Definition: buffer.hpp:54
Basic template for vector types.
Definition: fwd.hpp:43
Class wrapping buffer functions with explicit target selector.
Definition: buffer.hpp:433
Bitfield< BufferMapAccess > Access(void) const
Definition: buffer.hpp:343
const BoundObjOps & Data(const std::vector< GLtype > &data, BufferUsage usage=BufferUsage::StaticDraw) const
Definition: buffer.hpp:135
BufferTarget
Buffer bind target.
Definition: buffer_target.hpp:24

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).