1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-03-13 02:42:08 +00:00
Files
CLK/Outputs/OpenGL/Primitives/VertexArray.hpp
2026-02-03 16:22:13 -05:00

43 lines
815 B
C++

//
// VertexArray.hpp
// Clock Signal Kiosk
//
// Created by Thomas Harte on 29/01/2026.
// Copyright © 2026 Thomas Harte. All rights reserved.
//
#pragma once
#include "Outputs/OpenGL/OpenGL.hpp"
namespace Outputs::Display::OpenGL {
/*!
A vertex array plus its underlying buffer.
*/
class VertexArray {
public:
template <typename ContainerT>
VertexArray(const ContainerT &container) :
VertexArray(std::size(container), sizeof(container[0])) {}
VertexArray(size_t num_elements, size_t element_size);
~VertexArray();
VertexArray() = default;
VertexArray(VertexArray &&);
VertexArray &operator =(VertexArray &&);
void bind() const;
void bind_buffer() const;
void bind_all() const;
bool empty() const {
return buffer_ == 0;
}
private:
GLuint buffer_ = 0;
GLuint vertex_array_ = 0;
};
}