/// <summary> /// Binds this VertexArrayObject and the associated IndexBuffer if there is one /// </summary> /// <param name="control"></param> public void Use() { GL.BindVertexArray(vaoID); if (indexBuffer.HasValue) { GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBuffer.Value); } if (GLErrorHandler.CheckGLError()) { Debugger.Break(); } }
public void Initialize() { if (_disposed || ID != -1) { return; } GL.GenVertexArrays(1, out int vao); Bind(); ID = vao; if (GLErrorHandler.CheckGLError()) { Debugger.Break(); } }
/// <summary> /// Inits the vertex array object with a new ID. /// </summary> public void Initialize() { if (vaoID != -1) { return; } GL.GenVertexArrays(1, out int vao); GL.BindVertexArray(vao); GL.BindBuffer(BufferTarget.ArrayBuffer, buffer); vaoID = vao; foreach (KeyValuePair <int, VertexAttribute> a in attributes) { GL.EnableVertexAttribArray(a.Key); GL.VertexAttribPointer(a.Key, a.Value.size, a.Value.type, a.Value.normalized, a.Value.stride, a.Value.offset); } if (GLErrorHandler.CheckGLError()) { Debugger.Break(); } }