Files
portersky 30ddaf7d39 feat: render spinning 3D cube with glm
- Add glm dependency for matrix transformations
- Replace triangle with 6-face colored cube
- Add MVP shader uniforms (model, view, projection)
- Enable depth testing for proper 3D rendering
- Spin cube around (1, 0.5, 0.3) axis

style: fix trailing return type for move assignment operators

- buffer/texture/shader/vao: use auto fn() -> T& style
- Document trailing return type convention in AGENTS.md
2026-05-05 22:19:33 +02:00

48 lines
736 B
C++

#include "cbt/opengl/vao.hpp"
namespace cbt::opengl {
vao::vao() {
glGenVertexArrays(1, &m_id);
}
vao::~vao() {
if (m_id) {
glDeleteVertexArrays(1, &m_id);
}
}
vao::vao(vao&& other) noexcept
: m_id(other.m_id) {
other.m_id = 0;
}
auto vao::operator=(vao&& other) noexcept -> vao& {
if (this != &other) {
if (m_id) {
glDeleteVertexArrays(1, &m_id);
}
m_id = other.m_id;
other.m_id = 0;
}
return *this;
}
auto vao::bind() const -> void {
glBindVertexArray(m_id);
}
auto vao::unbind() const -> void {
glBindVertexArray(0);
}
auto vao::id() const -> GLuint {
return m_id;
}
auto vao::valid() const -> bool {
return m_id != 0;
}
}