VertexBuffer.h 1000 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef VERTEXBUFFER_H
  2. #define VERTEXBUFFER_H
  3. #include "rendering/Attributes.h"
  4. #include "wrapper/GL.h"
  5. class VertexBuffer final {
  6. GL::VertexArray vertexArray;
  7. GL::Buffer vertexBuffer;
  8. public:
  9. VertexBuffer();
  10. ~VertexBuffer();
  11. VertexBuffer(const VertexBuffer& other) = delete;
  12. VertexBuffer(VertexBuffer&& other) = delete;
  13. VertexBuffer& operator=(const VertexBuffer& other) = delete;
  14. VertexBuffer& operator=(VertexBuffer&& other) = delete;
  15. void setAttributes(const Attributes& attributes);
  16. void setStaticData(int size, const void* data = nullptr);
  17. void setStreamData(int size, const void* data = nullptr);
  18. void setDynamicData(int size, const void* data = nullptr);
  19. void updateData(int offset, int size, const void* data);
  20. void draw(int vertices, int offset = 0);
  21. void drawStrip(int vertices, int offset = 0);
  22. void drawPoints(int vertices, int offset = 0);
  23. private:
  24. void bindArray() const;
  25. void bindBuffer() const;
  26. };
  27. #endif