| 1234567891011121314151617181920212223242526272829303132333435363738 |
- // ----------------------------------------------------------------
- // From Game Programming in C++ by Sanjay Madhav
- // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
- //
- // Released under the BSD License
- // See LICENSE in root directory for full details.
- // ----------------------------------------------------------------
- #pragma once
- class VertexArray
- {
- public:
- // Different supported vertex layouts
- enum Layout
- {
- PosNormTex,
- PosNormSkinTex
- };
- VertexArray(const void* verts, unsigned int numVerts, Layout layout,
- const unsigned int* indices, unsigned int numIndices);
- ~VertexArray();
- void SetActive();
- unsigned int GetNumIndices() const { return mNumIndices; }
- unsigned int GetNumVerts() const { return mNumVerts; }
- private:
- // How many vertices in the vertex buffer?
- unsigned int mNumVerts;
- // How many indices in the index buffer
- unsigned int mNumIndices;
- // OpenGL ID of the vertex buffer
- unsigned int mVertexBuffer;
- // OpenGL ID of the index buffer
- unsigned int mIndexBuffer;
- // OpenGL ID of the vertex array object
- unsigned int mVertexArray;
- };
|