summaryrefslogtreecommitdiff
path: root/include/llmr/geometry/vertex_buffer.hpp
blob: 9478d7b15feef20c08ab6a3c36319b0ceb9b4896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef LLMR_GEOMETRY_VERTEX_BUFFER
#define LLMR_GEOMETRY_VERTEX_BUFFER

#include <vector>
#include <cstddef>
#include <cstdint>
#include <cmath>

namespace llmr {

class VertexBuffer {
public:
    typedef int16_t vertex_type;
    VertexBuffer(std::initializer_list<vertex_type> init);
    ~VertexBuffer();

    /*
     * Returns the number of elements in this buffer. This is not the number of
     * bytes, but rather the number of coordinates with associated information.
     */
    size_t index() const;

    /*
     * Transfers this buffer to the GPU and binds the buffer to the GL context.
     */
    void bind();

private:
    const std::vector<vertex_type> array;
    uint32_t buffer = 0;
};

}

#endif