33 lines
467 B
D
33 lines
467 B
D
module gltk.array;
|
|
import derelict.opengl;
|
|
|
|
class Array
|
|
{
|
|
private GLuint m_id;
|
|
|
|
this()
|
|
{
|
|
m_id = 0u;
|
|
glGenVertexArrays(1, &m_id);
|
|
if (m_id == 0u)
|
|
{
|
|
throw new Exception("Failed to allocate an OpenGL array");
|
|
}
|
|
}
|
|
|
|
~this()
|
|
{
|
|
glDeleteVertexArrays(1, &m_id);
|
|
}
|
|
|
|
void bind()
|
|
{
|
|
glBindVertexArray(m_id);
|
|
}
|
|
|
|
@property GLuint id()
|
|
{
|
|
return m_id;
|
|
}
|
|
}
|