Trait glitter::types::GLObject
[−]
[src]
pub trait GLObject { type Id; unsafe fn from_raw(id: Self::Id) -> Self; fn id(&self) -> Self::Id; fn into_raw(self) -> Self::Id
where
Self: Sized, { ... } }
An OpenGL object.
Associated Types
type Id
The type of the object's internal ID.
Required Methods
unsafe fn from_raw(id: Self::Id) -> Self
Get a new object from an OpenGL ID.
Safety
The provided ID must correspond to an instance of the target type. Providing an invalid object ID is considered undefined behavior in glitter.
Additionally, using from_raw
should not be used to create two
objects that contain the same ID. Doing so will likely lead to
the object being freed twice (which may not be catastrophic in
OpenGL).
fn id(&self) -> Self::Id
Get the object's ID.
Provided Methods
fn into_raw(self) -> Self::Id where
Self: Sized,
Self: Sized,
Consume the object without cleaning up its resources, returning the object's ID.
Note
To properly clean up the object's resources, the returned ID
should be passed to GLObject::from_raw
so that the object
will be properly destroyed.
Implementors
impl GLObject for Buffer type Id = GLuint;
impl GLObject for Shader type Id = GLuint;
impl GLObject for Program type Id = GLuint;
impl GLObject for Framebuffer type Id = GLuint;
impl GLObject for Renderbuffer type Id = GLuint;
impl<T: TextureType> GLObject for Texture<T> type Id = GLuint;