OGLplus (0.52.0) a C++ wrapper for OpenGL

buffer.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_BUFFER_1107121519_HPP
14 #define OGLPLUS_BUFFER_1107121519_HPP
15 
16 #include <oglplus/glfunc.hpp>
17 #include <oglplus/error/object.hpp>
21 #include <oglplus/buffer_usage.hpp>
24 #include <oglplus/buffer_map.hpp>
25 #include <oglplus/buffer_data.hpp>
28 #include <oglplus/data_type.hpp>
29 #include <oglplus/pixel_data.hpp>
30 
31 #include <vector>
32 #include <cassert>
33 
34 namespace oglplus {
35 
37 
44 template <>
45 class ObjGenDelOps<tag::Buffer>
46 {
47 protected:
48  static void Gen(tag::Generate, GLsizei count, GLuint* names)
49  {
50  assert(names != nullptr);
51  OGLPLUS_GLFUNC(GenBuffers)(count, names);
52  OGLPLUS_CHECK_SIMPLE(GenBuffers);
53  }
54 #if GL_VERSION_4_5 || GL_ARB_direct_state_access
55  static void Gen(tag::Create, GLsizei count, GLuint* names)
56  {
57  assert(names != nullptr);
58  OGLPLUS_GLFUNC(GenBuffers)(count, names);
59  OGLPLUS_CHECK_SIMPLE(GenBuffers);
60  }
61 #endif
62 
63  static void Delete(GLsizei count, GLuint* names)
64  {
65  assert(names != nullptr);
66  OGLPLUS_GLFUNC(DeleteBuffers)(count, names);
67  OGLPLUS_VERIFY_SIMPLE(DeleteBuffers);
68  }
69 
70  static GLboolean IsA(GLuint name)
71  {
72  assert(name != 0);
73  GLboolean result = OGLPLUS_GLFUNC(IsBuffer)(name);
74  OGLPLUS_VERIFY_SIMPLE(IsBuffer);
75  return result;
76  }
77 };
78 
80 template <>
81 class ObjBindingOps<tag::Buffer>
82 {
83 private:
84  static GLenum _binding_query(BufferTarget target);
85  static GLenum _binding_query(BufferIndexedTarget target);
86 protected:
87  static GLuint _binding(BufferTarget target);
88  static GLuint _binding(BufferIndexedTarget target, GLuint index);
89 public:
92 
95 
97 
101  static BufferName Binding(Target target)
102  {
103  return BufferName(_binding(target));
104  }
105 
107 
111  static void Bind(
112  Target target,
113  BufferName buffer
114  )
115  {
116  OGLPLUS_GLFUNC(BindBuffer)(
117  GLenum(target),
118  GetGLName(buffer)
119  );
120  OGLPLUS_VERIFY(
121  BindBuffer,
122  ObjectError,
123  Object(buffer).
124  BindTarget(target)
125  );
126  }
127 
129 
133  static BufferName Binding(IndexedTarget target, GLuint idx)
134  {
135  return BufferName(_binding(target, idx));
136  }
137 
139 
142  static void BindBase(
143  IndexedTarget target,
144  GLuint index,
145  BufferName buffer
146  )
147  {
148  OGLPLUS_GLFUNC(BindBufferBase)(
149  GLenum(target),
150  index,
151  GetGLName(buffer)
152  );
153  OGLPLUS_VERIFY(
154  BindBufferBase,
155  ObjectError,
156  Object(buffer).
157  BindTarget(target)
158  );
159  }
160 
162 
165  static void BindRange(
166  IndexedTarget target,
167  GLuint index,
168  BufferName buffer,
169  BufferSize offset,
170  BufferSize size
171  )
172  {
173  OGLPLUS_GLFUNC(BindBufferRange)(
174  GLenum(target),
175  index,
176  GetGLName(buffer),
177  GLintptr(offset.Get()),
178  GLsizeiptr(size.Get())
179  );
180  OGLPLUS_VERIFY(
181  BindBufferRange,
182  ObjectError,
183  Object(buffer).
184  BindTarget(target)
185  );
186  }
187 
188 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_multi_bind
189  static void BindBase(
190  BufferIndexedTarget target,
191  GLuint first,
192  GLsizei count,
193  const GLuint* names
194  )
195  {
196  OGLPLUS_GLFUNC(BindBuffersBase)(
197  GLenum(target),
198  first,
199  count,
200  names
201  );
202  OGLPLUS_VERIFY(
203  BindBuffersBase,
204  ObjectError,
205  BindTarget(target)
206  );
207  }
208 
210 
215  static void BindBase(
216  BufferIndexedTarget target,
217  GLuint first,
218  const Sequence<BufferName>& buffers
219  )
220  {
221  BindBase(
222  target,
223  first,
224  GLsizei(buffers.size()),
225  GetGLNames(buffers)
226  );
227  }
228 
229  static void BindRange(
230  BufferIndexedTarget target,
231  GLuint first,
232  GLsizei count,
233  const GLuint* names,
234  const GLintptr* offsets,
235  const GLsizeiptr* sizes
236  )
237  {
238  OGLPLUS_GLFUNC(BindBuffersRange)(
239  GLenum(target),
240  first,
241  count,
242  names,
243  offsets,
244  sizes
245  );
246  OGLPLUS_VERIFY(
247  BindBuffersRange,
248  ObjectError,
249  BindTarget(target)
250  );
251  }
252 
253  static void BindRange(
254  BufferIndexedTarget target,
255  GLuint first,
256  const Sequence<BufferName>& buffers,
257  const GLintptr* offsets,
258  const GLsizeiptr* sizes
259  )
260  {
261  BindRange(
262  target,
263  first,
264  GLsizei(buffers.size()),
265  GetGLNames(buffers),
266  offsets,
267  sizes
268  );
269  }
270 #endif
271 };
272 
274 
277 template <>
278 class ObjCommonOps<tag::Buffer>
279  : public BufferName
280  , public ObjBindingOps<tag::Buffer>
281 {
282 protected:
283  ObjCommonOps(void){ }
284 public:
288 
290 
294  void Bind(Target target) const
295  {
296  Bind(target, *this);
297  }
298 
299  void Bind(IndexedTarget target, GLuint index) const
300  {
301  BindBase(target, index, *this);
302  }
303 
305 
309  void BindBase(IndexedTarget target, GLuint index) const
310  {
311  BindBase(target, index, *this);
312  }
313 
314 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_0 || GL_ARB_transform_feedback3
315 
322  {
323  BindBase(IndexedTarget::Uniform, GLuint(index));
324  }
325 #endif
326 
327 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_0 || GL_ARB_transform_feedback3
328 
336  ) const
337  {
338  BindBase(IndexedTarget::TransformFeedback, GLuint(index));
339  }
340 #endif
341 
342 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_2 || GL_ARB_shader_atomic_counters
343 
350  {
351  BindBase(IndexedTarget::AtomicCounter, GLuint(index));
352  }
353 #endif
354 
355 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3 || GL_ARB_shader_storage_buffer_object
356 
363  {
364  BindBase(IndexedTarget::ShaderStorage, GLuint(index));
365  }
366 #endif
367 
369 
373  void BindRange(
374  IndexedTarget target,
375  GLuint index,
376  BufferSize offset,
377  BufferSize size
378  ) const
379  {
380  BindRange(target, index, *this, offset, size);
381  }
382 
383 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3 || GL_ARB_invalidate_subdata
384 
393  void InvalidateData(void)
394  {
395  OGLPLUS_GLFUNC(InvalidateBufferData)(_name);
396  OGLPLUS_CHECK(
397  InvalidateBufferData,
398  ObjectError,
399  Object(*this)
400  );
401  }
402 
404 
414  {
415  OGLPLUS_GLFUNC(InvalidateBufferSubData)(
416  _name,
417  GLintptr(offset.Get()),
418  GLsizeiptr(size.Get())
419  );
420  OGLPLUS_CHECK(
421  InvalidateBufferSubData,
422  ObjectError,
423  Object(*this)
424  );
425  }
426 #endif
427 };
428 
430 
432 template <>
433 class ObjectOps<tag::ExplicitSel, tag::Buffer>
434  : public ObjZeroOps<tag::ExplicitSel, tag::Buffer>
435 {
436 protected:
437  ObjectOps(void) { }
438 public:
439  static GLint GetIntParam(Target target, GLenum query);
440 
442  struct Property
443  {
446 
449  };
450 
451 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
454 
456 
463  static bool Mapped(Target target)
464  {
465  return GetIntParam(target, GL_BUFFER_MAPPED) == GL_TRUE;
466  }
467 #endif // GL_VERSION_3_0
468 
470 
479  static void Resize(
480  Target target,
481  BufferSize size,
483  )
484  {
485  OGLPLUS_GLFUNC(BufferData)(
486  GLenum(target),
487  size.Get(),
488  nullptr,
489  GLenum(usage)
490  );
491  OGLPLUS_CHECK(
492  BufferData,
493  ObjectError,
494  ObjectBinding(target).
495  EnumParam(usage)
496  );
497  }
498 
500 
507  static void Data(
508  Target target,
509  const BufferData& data,
511  )
512  {
513  OGLPLUS_GLFUNC(BufferData)(
514  GLenum(target),
515  GLsizei(data.Size()),
516  data.Data(),
517  GLenum(usage)
518  );
519  OGLPLUS_CHECK(
520  BufferData,
521  ObjectError,
522  ObjectBinding(target).
523  EnumParam(usage)
524  );
525  }
526 
528 
536  static void RawData(
537  Target target,
538  BufferSize size,
539  const GLvoid* data,
541  )
542  {
543  Data(target, BufferData(size, data), usage);
544  }
545 
547 
555  template <typename GLtype>
556  static void Data(
557  Target target,
558  GLsizei count,
559  const GLtype* data,
561  )
562  {
563  Data(target, BufferData(count, data), usage);
564  }
565 
566  static void SubData(
567  Target target,
568  BufferSize offset,
569  const BufferData& data
570  )
571  {
572  OGLPLUS_GLFUNC(BufferSubData)(
573  GLenum(target),
574  GLintptr(offset.Get()),
575  GLsizei(data.Size()),
576  data.Data()
577  );
578  OGLPLUS_CHECK(
579  BufferSubData,
580  ObjectError,
581  ObjectBinding(target)
582  );
583  }
584 
586 
591  template <typename GLtype>
592  static void SubData(
593  Target target,
594  BufferSize offset,
595  GLsizei count,
596  const GLtype* data
597  )
598  {
599  SubData(target, offset, BufferData(count, data));
600  }
601 
602 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_1 || GL_ARB_copy_buffer
603 
611  static inline void CopySubData(
612  BufferTarget readtarget,
613  BufferTarget writetarget,
614  BufferSize readoffset,
615  BufferSize writeoffset,
616  BufferSize size
617  )
618  {
619  OGLPLUS_GLFUNC(CopyBufferSubData)(
620  GLenum(readtarget),
621  GLenum(writetarget),
622  GLintptr(readoffset.Get()),
623  GLintptr(writeoffset.Get()),
624  GLsizeiptr(size.Get())
625  );
626  OGLPLUS_CHECK(
627  CopyBufferSubData,
628  ObjectPairError,
629  SubjectBinding(readtarget).
630  ObjectBinding(writetarget)
631  );
632  }
633 #endif // copy buffer
634 
635 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
636 
647  template <typename GLtype>
648  static void ClearData(
649  Target target,
650  PixelDataInternalFormat internal_format,
651  PixelDataFormat format,
652  const GLtype* data
653  )
654  {
655  OGLPLUS_GLFUNC(ClearBufferData)(
656  GLenum(target),
657  GLenum(internal_format),
658  GLenum(format),
659  GLenum(GetDataType<GLtype>()),
660  data
661  );
662  OGLPLUS_CHECK(
663  ClearBufferData,
664  ObjectError,
665  ObjectBinding(target)
666  );
667  }
668 
670 
680  template <typename GLtype>
681  static void ClearSubData(
682  Target target,
683  PixelDataInternalFormat internal_format,
684  BufferSize offset,
685  BufferSize size,
686  PixelDataFormat format,
687  const GLtype* data
688  )
689  {
690  OGLPLUS_GLFUNC(ClearBufferSubData)(
691  GLenum(target),
692  GLenum(internal_format),
693  GLintptr(offset.Get()),
694  GLsizeiptr(size.Get()),
695  GLenum(format),
696  GLenum(GetDataType<GLtype>()),
697  data
698  );
699  OGLPLUS_CHECK(
700  ClearBufferSubData,
701  ObjectError,
702  ObjectBinding(target).
703  EnumParam(internal_format)
704  );
705  }
706 #endif
707 
708 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_buffer_storage
709  static void Storage(
710  Target target,
711  const BufferData& data,
713  )
714  {
715  OGLPLUS_GLFUNC(BufferStorage)(
716  GLenum(target),
717  GLsizeiptr(data.Size()),
718  data.Data(),
719  GLbitfield(flags)
720  );
721  OGLPLUS_CHECK(
722  BufferStorage,
723  ObjectError,
724  ObjectBinding(target)
725  );
726  }
727 
729 
740  static void Storage(
741  Target target,
742  BufferSize size,
743  const void* data,
745  )
746  {
747  Storage(target, BufferData(size, data), flags);
748  }
749 
751 
759  static bool ImmutableStorage(Target target)
760  {
761  return GetIntParam(
762  target,
763  GL_BUFFER_IMMUTABLE_STORAGE
764  ) == GL_TRUE;
765  }
766 
768 
777  {
778  return Bitfield<BufferStorageBit>(GLbitfield(
779  GetIntParam(target, GL_BUFFER_STORAGE_FLAGS)
780  ));
781  }
782 #endif
783 
784 #if OGLPLUS_DOCUMENTATION_ONLY || GL_ARB_sparse_buffer
785  static void PageCommitment(
786  Target target,
787  BufferSize offset,
788  BufferSize size,
789  bool commit
790  )
791  {
792  OGLPLUS_GLFUNC(BufferPageCommitmentARB)(
793  GLenum(target),
794  GLintptr(offset.Get()),
795  GLsizeiptr(size.Get()),
796  commit?GL_TRUE:GL_FALSE
797  );
798  OGLPLUS_VERIFY(
799  BufferPageCommitmentARB,
800  ObjectError,
801  ObjectBinding(target)
802  );
803  }
804 
805  static GLsizei PageSize(void)
806  {
807  GLint value = 0;
808  OGLPLUS_GLFUNC(GetIntegerv)(
809  GL_SPARSE_BUFFER_PAGE_SIZE_ARB,
810  &value
811  );
812  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
813  return GLsizei(value);
814  }
815 #endif
816 
818 
825  static GLsizei Size(Target target)
826  {
827  return GLsizei(GetIntParam(target, GL_BUFFER_SIZE));
828  }
829 
831 
840  static BufferUsage Usage(Target target)
841  {
842  return BufferUsage(GetIntParam(target, GL_BUFFER_USAGE));
843  }
844 
845 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
846 
857  {
859  GLbitfield(GetIntParam(target, GL_BUFFER_ACCESS))
860  );
861  }
862 #endif
863 
864 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_shader_buffer_load
865 
873  static void MakeResident(Target target, AccessSpecifier access)
874  {
875  OGLPLUS_GLFUNC(MakeBufferResidentNV)(
876  GLenum(target),
877  GLenum(access)
878  );
879  OGLPLUS_CHECK(
880  MakeBufferResidentNV,
881  ObjectError,
882  ObjectBinding(target)
883  );
884  }
885 
887 
894  static void MakeNonResident(Target target)
895  {
896  OGLPLUS_GLFUNC(MakeBufferNonResidentNV)(GLenum(target));
897  OGLPLUS_CHECK(
898  MakeBufferNonResidentNV,
899  ObjectError,
900  ObjectBinding(target)
901  );
902  }
903 
905 
913  static BufferGPUAddress GPUAddress(Target target)
914  {
915  GLuint64EXT value = 0;
916  OGLPLUS_GLFUNC(GetBufferParameterui64vNV)(
917  GLenum(target),
918  GL_BUFFER_GPU_ADDRESS_NV,
919  &value
920  );
921  OGLPLUS_CHECK(
922  GetBufferParameterui64vNV,
923  ObjectError,
924  ObjectBinding(target)
925  );
926  return BufferGPUAddress(value);
927  }
928 #endif
929 };
930 
932 typedef ObjectOps<tag::ExplicitSel, tag::Buffer>
934 
935 // Helper class for syntax sugar operators
936 struct BufferTargetAndUsage
937 {
938  BufferTarget target;
939  BufferUsage usage;
940 
941  BufferTargetAndUsage(BufferTarget t, BufferUsage u)
942  : target(t)
943  , usage(u)
944  { }
945 };
946 
947 inline BufferTargetAndUsage operator << (
948  BufferTarget target,
949  BufferUsage usage
950 )
951 {
952  return BufferTargetAndUsage(target, usage);
953 }
954 
955 // Helper class for syntax sugar operators
956 struct BufferOpsAndIdxTgt
957 {
958  const BufferOps& buf;
959  BufferIndexedTarget target;
960 
961  BufferOpsAndIdxTgt(const BufferOps& b, BufferIndexedTarget t)
962  : buf(b)
963  , target(t)
964  { }
965 };
966 
967 inline BufferOpsAndIdxTgt operator << (
968  const BufferOps& buf,
969  BufferIndexedTarget target
970 )
971 {
972  return BufferOpsAndIdxTgt(buf, target);
973 }
974 
975 // Helper class for syntax sugar operators
976 struct BufferTargetAndOffset
977 {
978  BufferTarget target;
979  BufferSize offset;
980 
981  BufferTargetAndOffset(BufferTarget t, BufferSize o)
982  : target(t)
983  , offset(o)
984  { }
985 };
986 
987 inline BufferTargetAndOffset operator + (
988  BufferTarget target,
989  BufferSize offset
990 )
991 {
992  return BufferTargetAndOffset(target, offset);
993 }
994 
995 // Bind
996 inline BufferTarget operator << (
997  const BufferOps& buf,
998  BufferTarget target
999 )
1000 {
1001  buf.Bind(target);
1002  return target;
1003 }
1004 
1005 // BindBase
1006 inline const BufferOps& operator << (
1007  const BufferOpsAndIdxTgt& bat,
1008  GLuint index
1009 )
1010 {
1011  bat.buf.BindBase(bat.target, index);
1012  return bat.buf;
1013 }
1014 
1015 // Data
1016 inline BufferTarget operator << (
1017  BufferTarget target,
1018  const BufferData& data
1019 )
1020 {
1021  BufferOps::Data(target, data);
1022  return target;
1023 }
1024 
1025 // Data
1026 inline BufferTarget operator << (
1027  BufferTargetAndUsage&& tau,
1028  const BufferData& data
1029 )
1030 {
1031  BufferOps::Data(tau.target, data, tau.usage);
1032  return tau.target;
1033 }
1034 
1035 // SubData
1036 inline BufferTarget operator << (
1037  BufferTargetAndOffset&& tao,
1038  const BufferData& data
1039 )
1040 {
1041  BufferOps::SubData(tao.target, tao.offset, data);
1042  return tao.target;
1043 }
1044 
1046 
1049 typedef ObjectZero<ObjZeroOps<tag::ExplicitSel, tag::Buffer>>
1051 
1053 
1056 typedef Object<BufferOps> Buffer;
1057 
1058 } // namespace oglplus
1059 
1060 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
1061 #include <oglplus/buffer.ipp>
1062 #endif // OGLPLUS_LINK_LIBRARY
1063 
1064 #endif // include guard
BufferMapAccess MapAccess
The buffer map access mode.
Definition: buffer.hpp:448
Type for the uniform buffer binding point index.
Definition: buffer_binding.hpp:22
static void MakeResident(Target target, AccessSpecifier access)
Makes buffer currently bound to target accessible to GLSL shaders.
Definition: buffer.hpp:873
Common base class for Object name sequences.
Definition: fwd.hpp:139
BufferIndexedTarget IndexedTarget
Buffer indexed bind targets.
Definition: buffer.hpp:94
static BufferName Binding(Target target)
Returns the current Buffer bound to specified target.
Definition: buffer.hpp:101
PixelDataInternalFormat
OpenGL pixel data internal format enumeration.
Definition: pixel_data.hpp:79
Access type specifier enumeration.
Buffer bind target enumerations.
static BufferName Binding(IndexedTarget target, GLuint idx)
Returns the current Buffer bound to specified indexed target.
Definition: buffer.hpp:133
static void CopySubData(BufferTarget readtarget, BufferTarget writetarget, BufferSize readoffset, BufferSize writeoffset, BufferSize size)
Copy data between buffers.
Definition: buffer.hpp:611
static bool Mapped(Target target)
Returns true if the buffer is mapped.
Definition: buffer.hpp:463
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
Typed mapping of the buffer to the client address space.
Definition: buffer_map.hpp:231
Declaration of OGLplus object-related error.
Generic OpenGL object wrapper.
static void SubData(Target target, BufferSize offset, GLsizei count, const GLtype *data)
Uploads (sets) a subrange of the buffer data.
Definition: buffer.hpp:592
Object wrapping data to be stored in a Buffer.
std::size_t size(void) const
Returns the size of the sequence.
Definition: seq_tpl.hpp:166
This template serves as a wrapper for OpenGL bitfields.
Definition: bitfield.hpp:56
TRANSFORM_FEEDBACK_BUFFER.
Buffer usage enumeration.
static BufferUsage Usage(Target target)
Returns the buffer usage.
Definition: buffer.hpp:840
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
void BindBaseAtomicCounter(AtomicCounterBufferBindingPoint index) const
Bind this buffer to the specified atomic counter buffer binding point.
Definition: buffer.hpp:349
static Bitfield< BufferMapAccess > Access(Target target)
Returns the buffer usage.
Definition: buffer.hpp:856
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
AccessSpecifier
Enumeration of access type specifiers.
Definition: access_specifier.hpp:27
void InvalidateData(void)
Invalidate the buffer data.
Definition: buffer.hpp:393
ObjectOps< tag::ExplicitSel, tag::Buffer > BufferOps
The buffer operations with explicit selector.
Definition: buffer.hpp:933
static void ClearData(Target target, PixelDataInternalFormat internal_format, PixelDataFormat format, const GLtype *data)
Clear the buffer data.
Definition: buffer.hpp:648
void BindBaseUniform(UniformBufferBindingPoint index) const
Bind this buffer to the specified uniform buffer binding point.
Definition: buffer.hpp:321
Sequence of Object names.
PixelDataFormat
OpenGL pixel data format enumeration.
Definition: pixel_data.hpp:50
static void Bind(Target target, BufferName buffer)
Binds the specified buffer to the specified target.
Definition: buffer.hpp:111
static void Data(Target target, GLsizei count, const GLtype *data, BufferUsage usage=BufferUsage::StaticDraw)
Uploads (sets) the buffer data.
Definition: buffer.hpp:556
static void Resize(Target target, BufferSize size, BufferUsage usage=BufferUsage::StaticDraw)
Allocates buffer storage to the specified size without any data.
Definition: buffer.hpp:479
Helper macro for optional checking of availability of GL function.
void BindBase(IndexedTarget target, GLuint index) const
Binds this buffer to the specified indexed target.
Definition: buffer.hpp:309
const GLuint * GetGLNames(const Sequence< ObjName > &sequence)
Returns a pointer to array of GL object names stored in a sequence.
Definition: sequence.hpp:23
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
void InvalidateSubData(BufferSize offset, BufferSize size)
Invalidate a subrange of the buffer data.
Definition: buffer.hpp:413
void BindBaseShaderStorage(ShaderStorageBufferBindingPoint index) const
Bind this buffer to the specified shader storage buffer binding point.
Definition: buffer.hpp:362
ObjectZero< ObjZeroOps< tag::ExplicitSel, tag::Buffer > > NoBuffer
Class that can be used to unbind the currently bound buffers.
Definition: buffer.hpp:1050
Data type-related declarations.
GLsizeiptr Get(void) const
Gets the size in bytes.
Definition: buffer_size.hpp:58
BufferMapAccess
Buffer map access enumeration.
Definition: buffer_map_access.hpp:25
Pixel data-related declarations.
static void Storage(Target target, BufferSize size, const void *data, Bitfield< BufferStorageBit > flags)
Creates a data store for a buffer object.
Definition: buffer.hpp:740
Class used for passing the size of and pointer to data to be put in a Buffer.
Definition: buffer_data.hpp:21
Buffer map wrapper.
BufferIndexedTarget
Buffer indexed bind target.
Definition: buffer_target.hpp:46
BufferTarget Target
Buffer bind targets.
Definition: buffer.hpp:91
Object representing Buffer's GPU address.
static void BindBase(BufferIndexedTarget target, GLuint first, const Sequence< BufferName > &buffers)
Sequentially binds buffers to target starting at first index.
Definition: buffer.hpp:215
Type for the atomic counter buffer binding point index.
Definition: buffer_binding.hpp:58
Buffer storage bit enumeration.
void BindBaseTransformFeedback(TransformFeedbackBufferBindingPoint index) const
Bind this buffer to the specified TFB buffer binding point.
Definition: buffer.hpp:334
Exception class for GL object-related errors.
Definition: object.hpp:24
static void Data(Target target, const BufferData &data, BufferUsage usage=BufferUsage::StaticDraw)
Uploads (sets) the buffer data.
Definition: buffer.hpp:507
static void MakeNonResident(Target target)
Makes buffer currently bound to target inaccessible to GLSL shaders.
Definition: buffer.hpp:894
Type for the shader storage buffer binding point index.
Definition: buffer_binding.hpp:76
Object< BufferOps > Buffer
An oglplus_object encapsulating the OpenGL buffer functionality.
Definition: buffer.hpp:1056
static void BindBase(IndexedTarget target, GLuint index, BufferName buffer)
Bind the specified buffer to the specified indexed target.
Definition: buffer.hpp:142
static void RawData(Target target, BufferSize size, const GLvoid *data, BufferUsage usage=BufferUsage::StaticDraw)
Uploads (sets) the buffer data.
Definition: buffer.hpp:536
static Bitfield< BufferStorageBit > StorageFlags(Target target)
Returns the buffer storage flags.
Definition: buffer.hpp:776
static bool ImmutableStorage(Target target)
Returns true if the buffer storage is immutable.
Definition: buffer.hpp:759
void BindRange(IndexedTarget target, GLuint index, BufferSize offset, BufferSize size) const
Binds a range in this buffer to the specified indexed target.
Definition: buffer.hpp:373
Implements operations applicable to any object and any operation kind.
Definition: fwd.hpp:151
BufferUsage Usage
The Buffer usage mode.
Definition: buffer.hpp:445
static GLsizei Size(Target target)
Returns the buffer size.
Definition: buffer.hpp:825
static BufferGPUAddress GPUAddress(Target target)
Returns the GPU address of the buffer currently bound to target.
Definition: buffer.hpp:913
Buffer binding point indices.
static void BindRange(IndexedTarget target, GLuint index, BufferName buffer, BufferSize offset, BufferSize size)
Bind a range the specified buffer to the specified indexed target.
Definition: buffer.hpp:165
void Bind(Target target) const
Binds this buffer to the specified target.
Definition: buffer.hpp:294
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136
static void ClearSubData(Target target, PixelDataInternalFormat internal_format, BufferSize offset, BufferSize size, PixelDataFormat format, const GLtype *data)
Clear a subrange of the buffer data.
Definition: buffer.hpp:681
BufferTarget
Buffer bind target.
Definition: buffer_target.hpp:24
Type for the transform feedback buffer binding point index.
Definition: buffer_binding.hpp:40

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).