Struct cat_engine_basement::graphics::core::texture::Texture [−][src]
pub struct Texture { /* fields omitted */ }
Implementations
Generates a texture name.
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).
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).
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.
Texture parameters.
Specifies the index of the lowest defined mipmap level.
The initial value is 0.
pub 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
).
Specifies the texture comparison mode for currently bound depth textures (the iternal format = DEPTH_COMPONENT
).
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
.
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
.
Sets the wrap parameter for texture coordinate s
.
Initially, it is set to TextureWrap::Repeat
.
Sets the wrap parameter for texture coordinate t
.
Initially, it is set to TextureWrap::Repeat
.
Sets the wrap parameter for texture coordinate r
.
Initially, it is set to TextureWrap::Repeat
.
Texture 2D data.
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
)
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 of
k, if target is
GL_TEXTURE_RECTANGLEor
GL_PROXY_TEXTURE_RECTANGLEand
mipmap_levelis not
0`.
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
)
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.
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.