TRX/lib/glrage_gl/VertexArray.cpp

35 lines
588 B
C++
Raw Normal View History

2021-11-12 20:03:04 +01:00
#include "VertexArray.hpp"
namespace glrage {
namespace gl {
VertexArray::VertexArray()
{
glGenVertexArrays(1, &m_id);
}
VertexArray::~VertexArray()
{
glDeleteVertexArrays(1, &m_id);
}
void VertexArray::bind()
{
glBindVertexArray(m_id);
}
2021-11-14 23:59:19 +01:00
void VertexArray::attribute(GLuint index,
GLint size,
GLenum type,
GLboolean normalized,
GLsizei stride,
GLsizei offset)
2021-11-12 20:03:04 +01:00
{
glEnableVertexAttribArray(index);
glVertexAttribPointer(
index, size, type, normalized, stride, reinterpret_cast<void*>(offset));
}
} // namespace gl
} // namespace glrage