summaryrefslogtreecommitdiff
path: root/gfx/models/mesh.cpp
blob: 1b6ecda431669202cba6619520f7363e7c08fbe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "mesh.h"

MeshBase::MeshBase(GLsizei m_numIndices, GLenum mode, std::pair<RelativePosition3D, RelativePosition3D> minmax) :
	m_numIndices {m_numIndices}, mode {mode}, min {minmax.first}, max {minmax.second}
{
}

void
MeshBase::Draw() const
{
	glBindVertexArray(m_vertexArrayObject);

	glDrawElements(mode, m_numIndices, GL_UNSIGNED_INT, nullptr);

	glBindVertexArray(0);
}

void
MeshBase::DrawInstanced(GLuint vao, GLsizei count, GLuint base) const
{
	glBindVertexArray(vao);

	glDrawElementsInstancedBaseInstance(mode, m_numIndices, GL_UNSIGNED_INT, nullptr, count, base);

	glBindVertexArray(0);
}