+ GlState *self = reinterpret_cast<GlState *>(user_data);
+ self->texcoord_arrays[self->client_active_tex].set(size, type, false, stride, self->array_buffer, reinterpret_cast<long>(data));
+}
+
+void GlState::glEnableVertexAttribArray(void *user_data, unsigned index)
+{
+ reinterpret_cast<GlState *>(user_data)->attrib_arrays[index].enabled = true;
+}
+
+void GlState::glDisableVertexAttribArray(void *user_data, unsigned index)
+{
+ reinterpret_cast<GlState *>(user_data)->attrib_arrays[index].enabled = false;
+}
+
+void GlState::glVertexAttribPointer(void *user_data, unsigned index, int size, GLenum type, unsigned char norm, int stride, const void *data)
+{
+ GlState *self = reinterpret_cast<GlState *>(user_data);
+ self->attrib_arrays[index].set(size, type, norm, stride, self->array_buffer, reinterpret_cast<long>(data));
+}
+
+const ArrayState &GlState::get_array(GLenum array) const
+{
+ if(array==GL_VERTEX_ARRAY)
+ return vertex_array;
+ else if(array==GL_NORMAL_ARRAY)
+ return normal_array;
+ else if(array==GL_COLOR_ARRAY)
+ return color_array;
+ else if(array==GL_TEXTURE_COORD_ARRAY)
+ return texcoord_arrays[client_active_tex];
+ else
+ throw logic_error("Invalid array");
+}
+
+const ArrayState &GlState::get_texture_coord_array(unsigned index) const
+{
+ return texcoord_arrays[index];
+}
+
+const ArrayState &GlState::get_attrib_array(unsigned index) const
+{
+ return attrib_arrays[index];
+}
+
+// Array draw commands
+
+void GlState::glDrawElements(void *user_data, GLenum, int, GLenum type, const void *)
+{
+ if(BufferState *buf = reinterpret_cast<GlState *>(user_data)->element_buffer)
+ buf->content.update_elements(type);