VertexBuffer.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 init(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