123456789101112131415161718192021222324252627282930 |
- #ifndef VERTEXBUFFER_H
- #define VERTEXBUFFER_H
- #include <GL/glew.h>
- class VertexBuffer final {
- public:
- VertexBuffer();
- ~VertexBuffer();
- VertexBuffer(const VertexBuffer& other) = delete;
- VertexBuffer(VertexBuffer&& other) = delete;
- VertexBuffer& operator=(const VertexBuffer& other) = delete;
- VertexBuffer& operator=(VertexBuffer&& other) = delete;
-
- void setFloatAttribute(int index, int length, int offset, int step);
- void setColorAttribute(int index, int offset, int step);
- void setData(int size, const void* data);
-
- void bindArray() const;
- void bindBuffer() const;
- void bind() const;
-
- void draw(int vertices) const;
- private:
- GLuint vertexArray;
- GLuint vertexBuffer;
- };
- #endif
|