2
0

VertexArray.h 983 B

12345678910111213141516171819202122232425262728293031
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. class VertexArray
  10. {
  11. public:
  12. VertexArray(const float* verts, unsigned int numVerts,
  13. const unsigned int* indices, unsigned int numIndices);
  14. ~VertexArray();
  15. void SetActive();
  16. unsigned int GetNumIndices() const { return mNumIndices; }
  17. unsigned int GetNumVerts() const { return mNumVerts; }
  18. private:
  19. // How many vertices in the vertex buffer?
  20. unsigned int mNumVerts;
  21. // How many indices in the index buffer
  22. unsigned int mNumIndices;
  23. // OpenGL ID of the vertex buffer
  24. unsigned int mVertexBuffer;
  25. // OpenGL ID of the index buffer
  26. unsigned int mIndexBuffer;
  27. // OpenGL ID of the vertex array object
  28. unsigned int mVertexArray;
  29. };