41 "Vertex Buffer has no layout!");
43 this->VertexBuffer = VertexBuffer;
47 const auto &layout = VertexBuffer->GetVertexLayout();
48 for (
const auto &element : layout)
57 glEnableVertexAttribArray(element.Index);
58 glVertexAttribIPointer(element.Index,
60 GetGLShaderVariableType(element.Type),
62 (
const void *)(
u64)element.Offset);
68 glEnableVertexAttribArray(element.Index);
69 glVertexAttribPointer(element.Index,
71 GetGLShaderVariableType(element.Type),
74 (
const void *)(
u64)element.Offset);
79 for (uint8_t i = 0; i < count; i++)
81 glEnableVertexAttribArray(element.Index);
82 glVertexAttribPointer(element.Index,
84 GetGLShaderVariableType(element.Type),
87 (
const void *)(element.Offset +
sizeof(
float) * count * i));
88 glVertexAttribDivisor(element.Index, 1);
98 VertexBuffer->Unbind();
104 this->IndexBuffer = IndexBuffer;
108 IndexBuffer->Unbind();
114 glCreateVertexArrays(1, &Id);
115 SCL_CORE_ASSERT(Id != 0,
"Vertex array OpenGL primitive creation error.");
121 glDeleteVertexArrays(1, &Id);
127 glBindVertexArray(Id);
132 glBindVertexArray(0);
#define SCL_CORE_ASSERT(expr,...)
void SetIndexBuffer(const shared< index_buffer > &IndexBuffer)
gl_vertex_array(mesh_type MeshType)
void Unbind() const override
void Bind() const override
void SetVertexBuffer(const shared< vertex_buffer > &VertexBuffer)
static u32 GetShaderVariableComponentsCount(shader_variable_type Type)
#define SCL_CORE_SUCCES(...)
#define SCL_CORE_INFO(...)
std::shared_ptr< T > shared
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.