OGLplus (0.52.0) a C++ wrapper for OpenGL

buffer_data.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_BUFFER_DATA_1310102147_HPP
14 #define OGLPLUS_BUFFER_DATA_1310102147_HPP
15 
16 #include <oglplus/buffer_size.hpp>
17 
18 namespace oglplus {
19 
22 {
23 private:
24  BufferSize _size;
25  const GLvoid* _data;
26 
27  BufferData(const BufferData&);
28 public:
30  BufferData(BufferSize size, const GLvoid* data)
31  : _size(size)
32  , _data(data)
33  { }
34 
36  template <typename T>
37  BufferData(GLsizei count, const T* data)
38  : _size(count, data)
39  , _data(data)
40  { }
41 
43  template <typename T, std::size_t N>
44  BufferData(const T (&data)[N])
45  : _size(data)
46  , _data(data)
47  { }
48 
50  template <typename T, std::size_t N>
51  BufferData(const std::array<T, N>& a)
52  : _size(a)
53  , _data(a.data())
54  { }
55 
57  template <typename T>
58  BufferData(const std::vector<T>& v)
59  : _size(v)
60  , _data(v.data())
61  { }
62 
63  GLsizeiptr Size(void) const
64  {
65  return _size.Get();
66  }
67 
68  const GLvoid* Data(void) const
69  {
70  return _data;
71  }
72 };
73 
74 } // namespace oglplus
75 
76 #endif // include guard
BufferData(BufferSize size, const GLvoid *data)
Construction from size in bytes and pointer to data.
Definition: buffer_data.hpp:30
BufferData(GLsizei count, const T *data)
Construction from count of instances of type T at data.
Definition: buffer_data.hpp:37
BufferData(const std::vector< T > &v)
Construction from a std::vector.
Definition: buffer_data.hpp:58
This class represents the size of a GPU buffer in bytes.
Definition: buffer_size.hpp:22
Object representing Buffer's storage size in bytes.
BufferData(const std::array< T, N > &a)
Construction from a std::array.
Definition: buffer_data.hpp:51
BufferData(const T(&data)[N])
Construction from an array with known size.
Definition: buffer_data.hpp:44
GLsizeiptr Get(void) const
Gets the size in bytes.
Definition: buffer_size.hpp:58
Class used for passing the size of and pointer to data to be put in a Buffer.
Definition: buffer_data.hpp:21

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