12345678910111213141516171819202122232425262728293031323334353637 |
- #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 setAttributes(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
|