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

The type of the object's internal ID.

Required Methods

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).

Get the object's ID.

Provided Methods

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