Struct glitter::texture::Texture
[−]
[src]
pub struct Texture<T: TextureType> { /* fields omitted */ }
A type of OpenGL texture.
OpenGL supports a multitude of different types of textures. The simplest
of these is a Texture2d
, which is, as the name
suggests, a flat, 2-dimensional image. Textures serve two primary purposes
in OpenGL: to be used in a Shader
to
be used while drawing (such as to paint a polygon with an image), or
to be used as an attachment for a Framebuffer
, which can be used for
postprocessing effects (such as applying a gaussian blur to a scene).
In glitter, the Texture
type has a generic type parameter, which is used
to represent, at the type level, what type of image data a specific
texture contains. For simplicity, the Texture2d
and TextureCubeMap
type aliases are provided.
All textures will be automatically deleted after going out of scope.
For details about the different types of textures
read the documentation for the TextureBindingTarget
enum. For more details about the
generic type parameter of the Texture
type, read the documentation for
the TextureType
trait.
See also
gl.build_texture_2d
:
Build a new Texture2d
.
gl.gen_texture
:
Create a new, uninitialized texture. Note that this is currently the only
way to create textures that aren't 2D.
context::texture_units
: The module
with details details about binding a texture in a context.
Trait Implementations
impl<T: TextureType> Drop for Texture<T>
[src]
impl<T: TextureType> GLObject for Texture<T>
[src]
type Id = GLuint
The type of the object's internal ID.
unsafe fn from_raw(id: Self::Id) -> Self
Get a new object from an OpenGL ID. Read more
fn id(&self) -> Self::Id
Get the object's ID.
fn into_raw(self) -> Self::Id where
Self: Sized,
Self: Sized,
Consume the object without cleaning up its resources, returning the object's ID. Read more