/// <summary> /// Immediately binds an array buffer to the OpenGL context and updates the state cache. /// </summary> /// <param name="arrayBuffer">The array buffer to bind to the OpenGL context.</param> public static void BindArrayBuffer(UInt32 arrayBuffer) { gl.BindBuffer(gl.GL_ARRAY_BUFFER, arrayBuffer); gl.ThrowIfError(); GL_ARRAY_BUFFER_BINDING.Update(arrayBuffer); VerifyCache(); }
/// <summary> /// Indicates that the specified vertex array object has been deleted and updates the OpenGL state accordingly. /// </summary> /// <param name="vertexArrayObject">The vertex array object to delete.</param> /// <param name="arrayBuffer">The array buffer to delete.</param> /// <param name="elementArrayBuffer">The element array buffer to delete.</param> public static void DeleteVertexArrayObject(UInt32 vertexArrayObject, UInt32 arrayBuffer, UInt32 elementArrayBuffer) { if (GL_VERTEX_ARRAY_BINDING == vertexArrayObject) { GL_VERTEX_ARRAY_BINDING.Update(0); GL_ARRAY_BUFFER_BINDING.Update(0); GL_ELEMENT_ARRAY_BUFFER_BINDING.Update(0); VerifyCache(); } }
/// <summary> /// Immediately binds a vertex array object to the OpenGL context and updates the state cache. /// </summary> /// <param name="vertexArrayObject">The vertex array object to bind to the context.</param> /// <param name="arrayBuffer">The vertex array's associated array buffer.</param> /// <param name="elementArrayBuffer">The vertex array's associated element array buffer.</param> public static void BindVertexArrayObject(UInt32 vertexArrayObject, UInt32 arrayBuffer, UInt32 elementArrayBuffer) { gl.BindVertexArray(vertexArrayObject); gl.ThrowIfError(); GL_VERTEX_ARRAY_BINDING.Update(vertexArrayObject); GL_ARRAY_BUFFER_BINDING.Update(arrayBuffer); GL_ELEMENT_ARRAY_BUFFER_BINDING.Update(elementArrayBuffer); VerifyCache(); }
/// <summary> /// Immediately creates an array buffer and updates the state cache. /// </summary> /// <param name="buffer">The identifier of the buffer that was created.</param> public static void CreateArrayBuffer(out UInt32 buffer) { if (SupportsDirectStateAccessCreateFunctions) { buffer = gl.CreateBuffer(); gl.ThrowIfError(); } else { buffer = gl.GenBuffer(); gl.ThrowIfError(); if (!gl.IsDirectStateAccessAvailable) { gl.BindBuffer(gl.GL_ARRAY_BUFFER, buffer); gl.ThrowIfError(); GL_ARRAY_BUFFER_BINDING.Update(buffer); VerifyCache(); } } }