1 #ifndef GONG_GRAPHICS_VERTEXARRAY_HPP_
2 #define GONG_GRAPHICS_VERTEXARRAY_HPP_
11 template<std::size_t N>
15 static constexpr std::size_t NUM_ATTRS = N;
18 VertexArray() noexcept;
19 ~VertexArray() noexcept;
21 VertexArray(const VertexArray<N> &) = delete;
22 VertexArray<N> &operator =(const VertexArray<N> &) = delete;
24 VertexArray(VertexArray<N> &&) noexcept;
25 VertexArray<N> &operator =(VertexArray<N> &&) noexcept;
28 bool Empty() const noexcept { return idx_count == 0; }
30 void Bind() const noexcept;
33 void PushAttribute(std::size_t which, const std::vector<T> &data, bool normalized = false) noexcept;
36 void PushIndices(std::size_t which, const std::vector<T> &indices) noexcept;
38 void DrawLineElements() const noexcept;
39 void DrawTriangleElements() const noexcept;
42 void BindAttribute(std::size_t which) const noexcept;
43 void EnableAttribute(std::size_t which) noexcept;
45 void AttributeData(const std::vector<T> &) noexcept;
47 void AttributePointer(std::size_t which, bool normalized = false) noexcept;
49 void BindIndex(std::size_t which) const noexcept;
51 void IndexData(const std::vector<T> &) noexcept;
55 GLuint attr_id[NUM_ATTRS];
57 std::size_t idx_count;
65 #include "VertexArray.inl"