diff --git a/src/IndexedMesh.cpp b/src/IndexedMesh.cpp index d02d77711..d34d5d348 100644 --- a/src/IndexedMesh.cpp +++ b/src/IndexedMesh.cpp @@ -53,7 +53,7 @@ void IndexedMesh::draw() { /* Bind index array, draw the elements and unbind */ _indexBuffer.bind(); - glDrawElements(primitive(), indexCount, indexType, 0); + glDrawElements(primitive(), _indexCount, _indexType, 0); _indexBuffer.unbind(); /* Disable vertex arrays for all attributes */ diff --git a/src/IndexedMesh.h b/src/IndexedMesh.h index 981d1d92f..94def6a36 100644 --- a/src/IndexedMesh.h +++ b/src/IndexedMesh.h @@ -33,13 +33,19 @@ class IndexedMesh: public Mesh { public: /** * @brief Constructor - * @param _primitive Primitive type - * @param _vertexCount Count of unique vertices - * @param _indexCount Count of indices - * @param _indexType Type of indices (GL_UNSIGNED_BYTE, + * @param primitive Primitive type + * @param vertexCount Count of unique vertices + * @param indexCount Count of indices + * @param indexType Type of indices (GL_UNSIGNED_BYTE, * GL_UNSIGNED_SHORT or GL_UNSIGNED_INT) */ - inline IndexedMesh(Primitive _primitive, GLsizei _vertexCount, GLsizei _indexCount, GLenum _indexType = GL_UNSIGNED_SHORT): Mesh(_primitive, _vertexCount), _indexBuffer(Buffer::ElementArrayBuffer), indexCount(_indexCount), indexType(_indexType) {} + inline IndexedMesh(Primitive primitive, GLsizei vertexCount, GLsizei indexCount, GLenum indexType = GL_UNSIGNED_SHORT): Mesh(primitive, vertexCount), _indexBuffer(Buffer::ElementArrayBuffer), _indexCount(indexCount), _indexType(indexType) {} + + /** @brief Index count */ + inline GLsizei indexCount() const { return _indexCount; } + + /** @brief Index type */ + inline GLenum indexType() const { return _indexType; } /** * @brief Index buffer @@ -59,8 +65,8 @@ class IndexedMesh: public Mesh { private: Buffer _indexBuffer; - GLsizei indexCount; - GLenum indexType; + GLsizei _indexCount; + GLenum _indexType; }; }