#include <gl_buffer.h>
Vertex bufer interface.
Definition at line 83 of file gl_buffer.h.
◆ gl_vertex_buffer() [1/2]
scl::gl_vertex_buffer::gl_vertex_buffer |
( |
u32 |
Count, |
|
|
const vertex_layout & |
VertexLayout |
|
) |
| |
- Empty vertex buffer constructor.
- Parameters
-
Count | - vertices in buffer count. |
VertexLayout | - layout of vertices in buffer. |
- Returns
- constant buffer pointer.
Definition at line 76 of file gl_buffer.cpp.
76 :
78{
79 this->VerticesCount = Count;
80
81 glGenBuffers(1, &Id);
82 glBindBuffer(GL_ARRAY_BUFFER, Id);
83 glBufferData(GL_ARRAY_BUFFER, Count, nullptr, GL_DYNAMIC_DRAW);
84 glBindBuffer(GL_ARRAY_BUFFER, 0);
85
86 SCL_CORE_SUCCES(
"OpenGL Vertex buffer with id {} and {} verices created.", Id, Count);
87}
vertex_layout VertexLayout
vertex_buffer(const vertex_layout &VertexLayout)
#define SCL_CORE_SUCCES(...)
◆ gl_vertex_buffer() [2/2]
scl::gl_vertex_buffer::gl_vertex_buffer |
( |
const void * |
Vertices, |
|
|
u32 |
Count, |
|
|
const vertex_layout & |
VertexLayout |
|
) |
| |
- Vertex buffer filled with data constructor.
- Parameters
-
Vertices | - buffer data pointer. |
Count | - vertices in buffer count. |
VertexLayout | - layout of vertices in buffer. |
Definition at line 89 of file gl_buffer.cpp.
89 :
91{
92 this->VerticesCount = Count;
93
94 glCreateBuffers(1, &Id);
95 glBindBuffer(GL_ARRAY_BUFFER, Id);
97 glBindBuffer(GL_ARRAY_BUFFER, 0);
98
99 SCL_CORE_SUCCES(
"OpenGL Vertex buffer with id {} and {} verices created.", Id, Count);
100}
◆ ~gl_vertex_buffer()
scl::gl_vertex_buffer::~gl_vertex_buffer |
( |
| ) |
|
◆ Bind()
void scl::gl_vertex_buffer::Bind |
( |
| ) |
const |
|
overridevirtual |
- Bind buffer to current render stage function.
- Parameters
-
- Returns
- None.
Implements scl::vertex_buffer.
Definition at line 107 of file gl_buffer.cpp.
108{
109 if (Id != 0) glBindBuffer(GL_ARRAY_BUFFER, Id);
110}
◆ Free()
void scl::gl_vertex_buffer::Free |
( |
| ) |
|
|
overridevirtual |
- Clear buffer from GPU memory function.
- Parameters
-
- Returns
- None.
Implements scl::vertex_buffer.
Definition at line 129 of file gl_buffer.cpp.
130{
131 if (Id != 0)
132 {
133 glDeleteBuffers(1, &Id);
134
136 Id = 0, VerticesCount = 0;
137 }
138}
#define SCL_CORE_INFO(...)
◆ GetCount()
u32 scl::gl_vertex_buffer::GetCount |
( |
| ) |
const |
|
inlineoverridevirtual |
Vertex buffer data getter/setter functions.
Vertex buffer vertices count getter function.
Implements scl::vertex_buffer.
Definition at line 91 of file gl_buffer.h.
91{ return VerticesCount; }
◆ GetHandle()
render_primitive::handle scl::gl_vertex_buffer::GetHandle |
( |
| ) |
const |
|
inlineoverride |
Backend api render primitive hadnle getter function.
Definition at line 95 of file gl_buffer.h.
◆ Unbind()
void scl::gl_vertex_buffer::Unbind |
( |
| ) |
const |
|
overridevirtual |
- Unbind buffer from current render stage function.
- Parameters
-
- Returns
- None.
Implements scl::vertex_buffer.
Definition at line 112 of file gl_buffer.cpp.
113{
114 glBindBuffer(GL_ARRAY_BUFFER, 0);
115}
◆ Update()
void scl::gl_vertex_buffer::Update |
( |
const void * |
Vertices, |
|
|
u32 |
Count |
|
) |
| |
|
overridevirtual |
- Update buffer data function.
- Parameters
-
Vertices | - verices array. |
Count | - length of vertices array. |
- Returns
- None.
Implements scl::vertex_buffer.
Definition at line 117 of file gl_buffer.cpp.
118{
119 if (Id != 0)
120 {
121 SCL_CORE_ASSERT(Count == this->VerticesCount,
"Vertices count can't be changed.");
122
123 glBindBuffer(GL_ARRAY_BUFFER, Id);
125 glBindBuffer(GL_ARRAY_BUFFER, 0);
126 }
127}
#define SCL_CORE_ASSERT(expr,...)
The documentation for this class was generated from the following files: