VertexBuffer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. int size;
  9. public:
  10. VertexBuffer();
  11. ~VertexBuffer();
  12. VertexBuffer(const VertexBuffer& other) = delete;
  13. VertexBuffer(VertexBuffer&& other) = delete;
  14. VertexBuffer& operator=(const VertexBuffer& other) = delete;
  15. VertexBuffer& operator=(VertexBuffer&& other) = delete;
  16. void setAttributes(const Attributes& attributes);
  17. void setStaticData(int size, const void* data = nullptr);
  18. void setStreamData(int size, const void* data = nullptr);
  19. void setDynamicData(int size, const void* data = nullptr);
  20. void updateData(int offset, int size, const void* data);
  21. void draw(int vertices, int offset = 0);
  22. void drawStrip(int vertices, int offset = 0);
  23. void drawPoints(int vertices, int offset = 0);
  24. int getSize() const;
  25. private:
  26. void bindArray() const;
  27. void bindBuffer() const;
  28. };
  29. #endif