You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
681 B

  1. #pragma once
  2. #include "ggl.h"
  3. struct Vertex {
  4. float Position[4];
  5. float Color[4];
  6. float Texcoord[4];
  7. float Normal[4];
  8. };
  9. class VertexBuffer {
  10. public :
  11. static GLuint CreateBufferObject(GLenum bufferType, GLsizeiptr size, GLenum usage, void* data = nullptr);
  12. public:
  13. Vertex *mVertexes;
  14. int mVertexCount;
  15. GLuint mVBO;
  16. void SetSize(int vertexCount);
  17. void SetPosition(int index, float x, float y, float z, float w = 1.0f);
  18. void SetColor(int index, float r, float g, float b, float a = 1.0);
  19. void SetTexcoord(int index, float x, float y);
  20. void SetNormal(int index, float x, float y, float z);
  21. void Bind();
  22. void Unbind();
  23. Vertex& Get(int index);
  24. };