17 glBindBuffer(GL_UNIFORM_BUFFER, Id);
18 glBufferData(GL_UNIFORM_BUFFER, Size,
nullptr, GL_STATIC_DRAW);
19 glBindBuffer(GL_UNIFORM_BUFFER, 0);
21 SCL_CORE_SUCCES(
"OpenGL Constant buffer with id {} and size {} created.", Id, Size);
29 glBindBuffer(GL_UNIFORM_BUFFER, Id);
30 glBufferData(GL_UNIFORM_BUFFER, Size, Data, GL_STATIC_DRAW);
31 glBindBuffer(GL_UNIFORM_BUFFER, 0);
33 SCL_CORE_SUCCES(
"OpenGL Constant buffer with id {} and size {} created.", Id, Size);
43 this->BindingPoint = BindingPoint;
44 if (Id != 0) glBindBufferBase(GL_UNIFORM_BUFFER, BindingPoint, Id);
49 glBindBufferBase(GL_UNIFORM_BUFFER, BindingPoint, 0);
50 this->BindingPoint = 0;
57 SCL_CORE_ASSERT(this->Size == Size,
"Constant buffer size can't be changed.");
59 glBindBuffer(GL_UNIFORM_BUFFER, Id);
60 glBufferSubData(GL_UNIFORM_BUFFER, 0, Size, Data);
61 glBindBuffer(GL_UNIFORM_BUFFER, 0);
69 glDeleteBuffers(1, &Id);
71 SCL_CORE_INFO(
"OpenGL Constant buffer with id {} freed.", Id);
72 Id = 0, BindingPoint = 0, Size = 0;
79 this->VerticesCount = Count;
82 glBindBuffer(GL_ARRAY_BUFFER, Id);
83 glBufferData(GL_ARRAY_BUFFER, Count,
nullptr, GL_DYNAMIC_DRAW);
84 glBindBuffer(GL_ARRAY_BUFFER, 0);
86 SCL_CORE_SUCCES(
"OpenGL Vertex buffer with id {} and {} verices created.", Id, Count);
92 this->VerticesCount = Count;
94 glCreateBuffers(1, &Id);
95 glBindBuffer(GL_ARRAY_BUFFER, Id);
97 glBindBuffer(GL_ARRAY_BUFFER, 0);
99 SCL_CORE_SUCCES(
"OpenGL Vertex buffer with id {} and {} verices created.", Id, Count);
109 if (Id != 0) glBindBuffer(GL_ARRAY_BUFFER, Id);
114 glBindBuffer(GL_ARRAY_BUFFER, 0);
121 SCL_CORE_ASSERT(Count == this->VerticesCount,
"Vertices count can't be changed.");
123 glBindBuffer(GL_ARRAY_BUFFER, Id);
124 glBufferSubData(GL_ARRAY_BUFFER, 0, (
u64)Count * VertexLayout.GetSize(), Vertices);
125 glBindBuffer(GL_ARRAY_BUFFER, 0);
133 glDeleteBuffers(1, &Id);
136 Id = 0, VerticesCount = 0;
142 this->IndicesCount = Count;
144 glCreateBuffers(1, &Id);
145 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Id);
146 glBufferData(GL_ELEMENT_ARRAY_BUFFER, Count *
sizeof(
u32), Indices, GL_STATIC_DRAW);
148 SCL_CORE_SUCCES(
"OpenGL Index buffer with id {} and {} indices created.", Id, Count);
158 if (Id != 0) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Id);
163 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
170 SCL_CORE_ASSERT(this->IndicesCount == Count,
"Indices count cant'be changed.");
172 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Id);
173 glBufferData(GL_ELEMENT_ARRAY_BUFFER, Count *
sizeof(
u32), Indices, GL_STATIC_DRAW);
174 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
182 glDeleteBuffers(1, &Id);
185 Id = 0, IndicesCount = 0;
#define SCL_CORE_ASSERT(expr,...)
void Update(void *Data, u32 Size) override
gl_constant_buffer(u32 Size)
void Unbind() const override
~gl_constant_buffer() override
void Bind(u32 BindingPoint) const override
~gl_index_buffer() override
void Unbind() const override
void Update(u32 *Indices, u32 Count) override
void Bind() const override
gl_index_buffer(u32 *Indices, u32 Count)
void Update(const void *Vertices, u32 Count) override
void Bind() const override
gl_vertex_buffer(u32 Count, const vertex_layout &VertexLayout)
void Unbind() const override
vertex_layout VertexLayout
#define SCL_CORE_SUCCES(...)
#define SCL_CORE_INFO(...)
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.