VertexBuffer.h 752 B

123456789101112131415161718192021222324252627282930
  1. #ifndef VERTEXBUFFER_H
  2. #define VERTEXBUFFER_H
  3. #include <GL/glew.h>
  4. class VertexBuffer final {
  5. public:
  6. VertexBuffer();
  7. ~VertexBuffer();
  8. VertexBuffer(const VertexBuffer& other) = delete;
  9. VertexBuffer(VertexBuffer&& other) = delete;
  10. VertexBuffer& operator=(const VertexBuffer& other) = delete;
  11. VertexBuffer& operator=(VertexBuffer&& other) = delete;
  12. void setFloatAttribute(int index, int length, int offset, int step);
  13. void setColorAttribute(int index, int offset, int step);
  14. void setData(int size, const void* data);
  15. void bindArray() const;
  16. void bindBuffer() const;
  17. void bind() const;
  18. void draw(int vertices) const;
  19. private:
  20. GLuint vertexArray;
  21. GLuint vertexBuffer;
  22. };
  23. #endif