Use weak pointer to gl struct instead of cloning everything
@@ -3,35 +3,30 @@ mod bindings {
}
pub use bindings::*;
-pub use bindings::Gles2 as Gl;
-/*
use std::rc::Rc;
use std::ops::Deref;
-
-pub use bindings::*;
-pub use bindings::Gles2 as InnerGl;
+use bindings::Gles2 as InnerGl;
#[derive(Clone)]
pub struct Gl {
- inner: Rc<bindings::Gles2>,
+ inner: Rc<InnerGl>,
}
impl Gl {
pub fn load_with<F>(loadfn: F) -> Gl
- where F: FnMut(&'static str) -> *const types::GLvoid
+ where for<'r> F: FnMut(&'r str) -> *const types::GLvoid
{
Gl {
- inner: Rc::new(bindings::Gles2::load_with(loadfn))
+ inner: Rc::new(InnerGl::load_with(loadfn))
}
}
}
impl Deref for Gl {
- type Target = bindings::Gles2;
+ type Target = InnerGl;
- fn deref(&self) -> &bindings::Gles2 {
+ fn deref(&self) -> &InnerGl {
&self.inner
}
}
-*/
