diff --git a/src/lib.rs b/src/lib.rs index b5605ac..a191a66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -526,6 +526,8 @@ pub trait HasContext: __private::Sealed { unsafe fn create_vertex_array(&self) -> Result; + unsafe fn create_named_vertex_array(&self) -> Result; + unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray); unsafe fn bind_vertex_array(&self, vertex_array: Option); diff --git a/src/native.rs b/src/native.rs index e4a1938..80dca2d 100644 --- a/src/native.rs +++ b/src/native.rs @@ -1198,6 +1198,13 @@ impl HasContext for Context { Ok(NativeVertexArray(non_zero_gl_name(vertex_array))) } + unsafe fn create_named_vertex_array(&self) -> Result { + let gl = &self.raw; + let mut vertex_array = 0; + gl.CreateVertexArrays(1, &mut vertex_array); + Ok(NativeVertexArray(non_zero_gl_name(vertex_array))) + } + unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray) { let gl = &self.raw; gl.DeleteVertexArrays(1, &vertex_array.0.get()); diff --git a/src/web_sys.rs b/src/web_sys.rs index 7ef2ef9..d364db9 100644 --- a/src/web_sys.rs +++ b/src/web_sys.rs @@ -2469,6 +2469,9 @@ impl HasContext for Context { } } + unsafe fn create_named_vertex_array(&self) -> Result { + unimplemented!() + } unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray) { let mut vertex_arrays = self.vertex_arrays.borrow_mut(); if let Some(ref va) = vertex_arrays.remove(vertex_array) {