galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
ShaderStorageBuffer.cpp
Go to the documentation of this file.
1
7
9
10namespace galaxy
11{
12 namespace graphics
13 {
15 : m_id {0}
16 , m_index {index}
17 {
18 glCreateBuffers(1, &m_id);
19 }
20
22 {
23 if (this->m_id != 0)
24 {
25 glDeleteBuffers(1, &this->m_id);
26 }
27
28 this->m_index = s.m_index;
29 this->m_id = s.m_id;
30 s.m_id = 0;
31 }
32
34 {
35 if (this != &s)
36 {
37 if (this->m_id != 0)
38 {
39 glDeleteBuffers(1, &this->m_id);
40 }
41
42 this->m_index = s.m_index;
43 this->m_id = s.m_id;
44 s.m_id = 0;
45 }
46
47 return *this;
48 }
49
51 {
52 if (m_id != 0)
53 {
54 glDeleteBuffers(1, &m_id);
55 }
56 }
57
59 {
60 glBindBufferBase(GL_SHADER_STORAGE_BUFFER, m_index, m_id);
61 }
62
64 {
65 auto size = 0;
66
67 glGetNamedBufferParameteriv(m_id, GL_BUFFER_SIZE, &size);
68 glNamedBufferData(m_id, size, nullptr, GL_DYNAMIC_DRAW);
69 }
70
71 unsigned int ShaderStorageBuffer::id() const
72 {
73 return m_id;
74 }
75 } // namespace graphics
76} // namespace galaxy
Abstraction for OpenGL buffer objects.
void clear()
Clears data from buffer.
unsigned int id() const
Get OpenGL handle.
ShaderStorageBuffer & operator=(ShaderStorageBuffer &&)
Move assignment operator.
ShaderStorageBuffer()=delete
Default constructor.
Animated.cpp galaxy.
Definition Animated.cpp:16