func (vao *VAO) Enable(elements int, buffer *Buffer, attrib Attrib, opts ...VAOOption) { opt := vaoOption{ stride: 0, offset: 0, normalize: false, } for _, o := range opts { o(&opt) } gl.BindVertexArray(vao.id) defer gl.BindVertexArray(0) gl.BindBuffer(gl.ARRAY_BUFFER, buffer.id) defer gl.BindBuffer(gl.ARRAY_BUFFER, 0) gl.EnableVertexAttribArray(attrib.Location()) gl.VertexAttribPointer( attrib.Location(), int32(elements), buffer.data.typ, opt.normalize, int32(opt.stride*buffer.data.siz), gl.PtrOffset(opt.offset*buffer.data.siz)) }
func (vao *VAO) Use() { gl.BindVertexArray(vao.id) }