1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef VERTEXBUFFER_H
- #define VERTEXBUFFER_H
- #include "rendering/Attributes.h"
- #include "wrapper/GL.h"
- class VertexBuffer final {
- GL::VertexArray vertexArray;
- GL::Buffer vertexBuffer;
- int size;
- public:
- VertexBuffer();
- ~VertexBuffer();
- VertexBuffer(const VertexBuffer& other) = delete;
- VertexBuffer(VertexBuffer&& other) = delete;
- VertexBuffer& operator=(const VertexBuffer& other) = delete;
- VertexBuffer& operator=(VertexBuffer&& other) = delete;
- void init(const Attributes& attributes);
- void setStaticData(int size, const void* data = nullptr);
- void setStreamData(int size, const void* data = nullptr);
- void setDynamicData(int size, const void* data = nullptr);
- void updateData(int offset, int size, const void* data);
- void draw(int vertices, int offset = 0);
- void drawStrip(int vertices, int offset = 0);
- void drawPoints(int vertices, int offset = 0);
- int getSize() const;
- private:
- void bindArray() const;
- void bindBuffer() const;
- };
- #endif
|