pub struct Texture { /* private fields */ }Implementations§
Source§impl Texture
impl Texture
Sourcepub fn generate_one(&self, texture: &mut u32)
pub fn generate_one(&self, texture: &mut u32)
Generates a texture name.
Sourcepub unsafe fn delete_one(&self, texture: &u32)
pub unsafe fn delete_one(&self, texture: &u32)
Deletes a named texture.
Silently ignores 0’s and names that do not correspond to existing textures.
If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture).
Sourcepub fn delete(&self, textures: &[u32])
pub fn delete(&self, textures: &[u32])
Deletes named textures.
Silently ignores 0’s and names that do not correspond to existing textures.
If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture).
Sourcepub unsafe fn bind(&self, target: TextureBindTarget, texture_id: u32)
pub unsafe fn bind(&self, target: TextureBindTarget, texture_id: u32)
Binds a texture to a texturing target.
When a texture is bound to a target, the previous binding for that target is automatically broken.
When a texture is first bound, it assumes the specified target:
A texture first bound to GL_TEXTURE_1D becomes one-dimensional texture,
a texture first bound to GL_TEXTURE_2D becomes two-dimensional texture,
and so on.
GLError::InvalidValue is generated
if target is not a name returned from a previous call to glGenTextures.
GLError::InvalidOperation is generated
if texture was previously created with a target that doesn’t match that of target.
Source§impl Texture
Texture parameters.
impl Texture
Texture parameters.
Sourcepub fn set_base_level(&self, target: TextureParameterTarget, level: i32)
pub fn set_base_level(&self, target: TextureParameterTarget, level: i32)
Specifies the index of the lowest defined mipmap level.
The initial value is 0.
Sourcepub fn set_compare_function(
&self,
target: TextureParameterTarget,
function: TextureCompareFunction,
)
pub fn set_compare_function( &self, target: TextureParameterTarget, function: TextureCompareFunction, )
Specifies the comparison operator.
The comparison operator is used when TextureCompareMode::CompareRefToTexture is set (see Texture::set_compare_mode).
Sourcepub fn set_compare_mode(
&self,
target: TextureParameterTarget,
mode: TextureCompareMode,
)
pub fn set_compare_mode( &self, target: TextureParameterTarget, mode: TextureCompareMode, )
Specifies the texture comparison mode for currently bound depth textures (the iternal format = DEPTH_COMPONENT).
Sourcepub fn set_mag_filter(
&self,
target: TextureParameterTarget,
filter: TextureMagFilter,
)
pub fn set_mag_filter( &self, target: TextureParameterTarget, filter: TextureMagFilter, )
Specifies the texture magnification function.
The texture magnification function is used whenever the level-of-detail function used when sampling from the texture determines that the texture should be magified.
Initially, it is set to TextureMagFilter::Linear.
Sourcepub fn set_min_filter(
&self,
target: TextureParameterTarget,
filter: TextureMinFilter,
)
pub fn set_min_filter( &self, target: TextureParameterTarget, filter: TextureMinFilter, )
Specifies the texture minifying function.
The texture minifying function is used whenever the level-of-detail function used when sampling from the texture determines that the texture should be minified.
Initially, it is set to TextureMinFilter::LinearMipmapLinear.
Sourcepub fn set_wrap_s(&self, target: TextureParameterTarget, value: TextureWrap)
pub fn set_wrap_s(&self, target: TextureParameterTarget, value: TextureWrap)
Sets the wrap parameter for texture coordinate s.
Initially, it is set to TextureWrap::Repeat.
Sourcepub fn set_wrap_t(&self, target: TextureParameterTarget, value: TextureWrap)
pub fn set_wrap_t(&self, target: TextureParameterTarget, value: TextureWrap)
Sets the wrap parameter for texture coordinate t.
Initially, it is set to TextureWrap::Repeat.
Sourcepub fn set_wrap_r(&self, target: TextureParameterTarget, value: TextureWrap)
pub fn set_wrap_r(&self, target: TextureParameterTarget, value: TextureWrap)
Sets the wrap parameter for texture coordinate r.
Initially, it is set to TextureWrap::Repeat.
Source§impl Texture
Texture 2D data.
impl Texture
Texture 2D data.
Sourcepub unsafe fn rewrite_image_2d<I: Sized>(
&self,
target: Texture2DRewriteTarget,
mipmap_level: i32,
internal_format: Texture2DInternalFormat,
[width, height]: [i32; 2],
image_data_format: ImageDataFormat,
data: *const I,
)
pub unsafe fn rewrite_image_2d<I: Sized>( &self, target: Texture2DRewriteTarget, mipmap_level: i32, internal_format: Texture2DInternalFormat, [width, height]: [i32; 2], image_data_format: ImageDataFormat, data: *const I, )
Specify a two-dimensional texture image.
target - Specifies the target texture.
mipmap_level - Specifies the level-of-detail number.
Level 0 is the base image level.
Level n is the nth mipmap reduction image.
If target is Texture2DRewriteTarget::TextureRectangle
or Texture2DRewriteTarget::ProxyTextureRectangle,
level must be 0.
internal_format - Specifies the number of color components in the texture.
width - Specifies the width of the texture image.
All implementations support texture images that are at least 1024 texels wide.
height - Specifies the height of the texture image, or the number of layers in a texture array,
in the case of the Texture1DArray and ProxyTexture1DArray targets.
All implementations support 2D texture images that are at least 1024 texels high,
and texture arrays that are at least 256 layers deep.
image_format - Specifies the format of the pixel data.
image_data_type - Specifies the data type of the pixel data.
data - Specifies a pointer to the image data in memory.
GLError::InvalidEnum is generated
if target is one of the six cube map 2D image targets
and the width and height parameters are not equal.
GLError::InvalidValue is generated
if width is less than 0 or greater than GL_MAX_TEXTURE_SIZE,
if target is not GL_TEXTURE_1D_ARRAY or GL_PROXY_TEXTURE_1D_ARRAY
and height is less than 0 or greater than GL_MAX_TEXTURE_SIZE,
if target is GL_TEXTURE_1D_ARRAY or GL_PROXY_TEXTURE_1D_ARRAY
and height is less than 0 or greater than GL_MAX_ARRAY_TEXTURE_LAYERS,
if mipmap_level is less than 0,
if mipmap_level is greater than log2(max),
where max is the returned value of GL_MAX_TEXTURE_SIZE,
if width or height is less than 0 or greater than GL_MAX_TEXTURE_SIZE, if non-power-of-two textures are not supported and the width or height cannot be represented as 2^kfor some integer value ofk, if target is GL_TEXTURE_RECTANGLEorGL_PROXY_TEXTURE_RECTANGLEandmipmap_levelis not0`.
Sourcepub unsafe fn write_image_2d<I: Sized>(
&self,
target: Texture2DWriteTarget,
mipmap_level: i32,
[x, y, width, height]: [i32; 4],
image_data_format: ImageDataFormat,
data: *const I,
)
pub unsafe fn write_image_2d<I: Sized>( &self, target: Texture2DWriteTarget, mipmap_level: i32, [x, y, width, height]: [i32; 4], image_data_format: ImageDataFormat, data: *const I, )
Specify a two-dimensional texture subimage.
target - Specifies the target texture.
mipmap_level - Specifies the level-of-detail number.
Level 0 is the base image level.
Level n is the nth mipmap reduction image.
x - Specifies a texel offset in the x direction within the texture array.
y - Specifies a texel offset in the y direction within the texture array.
width - Specifies the width of the texture subimage.
height - Specifies the height of the texture subimage.
image_format - Specifies the format of the pixel data.
image_data_type - Specifies the data type of the pixel data.
data - Specifies a pointer to the image data in memory.
Sourcepub unsafe fn copy_image_2d(
&self,
target: Texture2DCopyTarget,
mipmap_level: i32,
[read_x, read_y]: [i32; 2],
[write_x, write_y]: [i32; 2],
[width, height]: [i32; 2],
)
pub unsafe fn copy_image_2d( &self, target: Texture2DCopyTarget, mipmap_level: i32, [read_x, read_y]: [i32; 2], [write_x, write_y]: [i32; 2], [width, height]: [i32; 2], )
Copies a two-dimensional texture subimage.
Replaces a rectangular portion of a two-dimensional texture image or cube-map texture image with pixels from the current READ_BUFFER.
target - Specifies the target texture.
mipmap_level - Specifies the level-of-detail number.
Level 0 is the base image level.
Level n is the nth mipmap reduction image.
read_x, read_y - Specify the window coordinates of the lower left corner
of the rectangular region of pixels to be copied.
write_x - Specifies a texel offset in the x direction within the texture array.
write_y - Specifies a texel offset in the y direction within the texture array.
width - Specifies the width of the texture subimage.
height - Specifies the height of the texture subimage.
GLError::InvalidOperation is generated
if the texture array has not been defined
by a previous Texture::rewrite_image_2d() or Texture::copy_image_2d() operation.
GLError::InvalidValue is generated if mipmap_level is less than 0,
if mipmap_level>log2(max), where max is the returned value of MAX_TEXTURE_SIZE,
if write_x<0, (write_x+width)>w, write_y<0, or (write_y+height)>h,
where w is the TEXTURE_WIDTH, and h is the TEXTURE_HEIGHT of the texture image being modified.