2
0

VertexArray.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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. // Activate this vertex array (so we can draw it)
  16. void SetActive();
  17. unsigned int GetNumIndices() const { return mNumIndices; }
  18. unsigned int GetNumVerts() const { return mNumVerts; }
  19. private:
  20. // How many vertices in the vertex buffer?
  21. unsigned int mNumVerts;
  22. // How many indices in the index buffer
  23. unsigned int mNumIndices;
  24. // OpenGL ID of the vertex buffer
  25. unsigned int mVertexBuffer;
  26. // OpenGL ID of the index buffer
  27. unsigned int mIndexBuffer;
  28. // OpenGL ID of the vertex array object
  29. unsigned int mVertexArray;
  30. };