pub trait GenericTexture: Debug {
Show 21 methods
// Required methods
fn get_glcore(&self) -> &GLCore;
fn get_name(&self) -> u32;
fn get_dim(&self) -> TextureDimension;
fn get_width(&self) -> u32;
fn get_height(&self) -> u32;
fn get_depth(&self) -> u32;
fn get_format(&self) -> TextureFormat;
fn get_bytes_of_face(&self) -> usize;
fn get_bytes_of_texture(&self) -> usize;
fn has_mipmap(&self) -> bool;
fn get_pixel_buffer(&self) -> Option<&dyn GenericPixelBuffer>;
fn create_pixel_buffer(
&mut self,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
initial_data: Option<*const c_void>,
);
fn drop_pixel_buffer(&mut self);
fn bind<'a>(&'a self) -> TextureBind<'a>;
fn bind_face<'a>(&'a self, face: CubeMapFaces) -> TextureBind<'a>;
// Provided methods
fn map_buffer<'a>(
&'a mut self,
access: MapAccess,
) -> Option<(BufferBind<'a>, BufferMapping<'a>, *mut c_void)> { ... }
unsafe fn download_texture(
&self,
data: *mut c_void,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
) { ... }
unsafe fn upload_texture(
&self,
data: *const c_void,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
regen_mipmap: bool,
) { ... }
fn pack_pixel_buffer(&self) { ... }
fn unpack_pixel_buffer(&self, regen_mipmap: bool) { ... }
fn set_active_unit(&self, unit: u32) { ... }
}
Expand description
The GenericTexture
trait helps the Texture
struct to be able to turn into an object
Required Methods§
Sourcefn get_glcore(&self) -> &GLCore
fn get_glcore(&self) -> &GLCore
Get the OpenGL core
Sourcefn get_dim(&self) -> TextureDimension
fn get_dim(&self) -> TextureDimension
Get the dimension of the texture
Sourcefn get_height(&self) -> u32
fn get_height(&self) -> u32
Get height
Sourcefn get_format(&self) -> TextureFormat
fn get_format(&self) -> TextureFormat
Get the texture internal format
Sourcefn get_bytes_of_face(&self) -> usize
fn get_bytes_of_face(&self) -> usize
Get byte of face
Sourcefn get_bytes_of_texture(&self) -> usize
fn get_bytes_of_texture(&self) -> usize
Get byte of texture level 0
Sourcefn has_mipmap(&self) -> bool
fn has_mipmap(&self) -> bool
Get if have mipmap
Sourcefn get_pixel_buffer(&self) -> Option<&dyn GenericPixelBuffer>
fn get_pixel_buffer(&self) -> Option<&dyn GenericPixelBuffer>
Get the pixel buffer
Sourcefn create_pixel_buffer(
&mut self,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
initial_data: Option<*const c_void>,
)
fn create_pixel_buffer( &mut self, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, initial_data: Option<*const c_void>, )
Create the PBO if not been created earlier
Sourcefn drop_pixel_buffer(&mut self)
fn drop_pixel_buffer(&mut self)
Discard the PBO if not necessarily need it
Sourcefn bind<'a>(&'a self) -> TextureBind<'a>
fn bind<'a>(&'a self) -> TextureBind<'a>
Bind the texture, using the RAII system to manage the binding state
Sourcefn bind_face<'a>(&'a self, face: CubeMapFaces) -> TextureBind<'a>
fn bind_face<'a>(&'a self, face: CubeMapFaces) -> TextureBind<'a>
Bind a cubemap face, using the RAII system to manage the binding state
Provided Methods§
Sourcefn map_buffer<'a>(
&'a mut self,
access: MapAccess,
) -> Option<(BufferBind<'a>, BufferMapping<'a>, *mut c_void)>
fn map_buffer<'a>( &'a mut self, access: MapAccess, ) -> Option<(BufferBind<'a>, BufferMapping<'a>, *mut c_void)>
Map the pixel buffer for the specified access
Sourceunsafe fn download_texture(
&self,
data: *mut c_void,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
)
unsafe fn download_texture( &self, data: *mut c_void, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, )
Retrieve the pixels from the texture to the specified data pointer regardless of is currently using a PBO or not
Sourceunsafe fn upload_texture(
&self,
data: *const c_void,
buffer_channel_type: ChannelType,
buffer_component_type: ComponentType,
regen_mipmap: bool,
)
unsafe fn upload_texture( &self, data: *const c_void, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, regen_mipmap: bool, )
Load the texture with the specified data pointer regardless of is currently using a PBO or not
Sourcefn pack_pixel_buffer(&self)
fn pack_pixel_buffer(&self)
Read the pixels from the texture to the pixel buffer
Sourcefn unpack_pixel_buffer(&self, regen_mipmap: bool)
fn unpack_pixel_buffer(&self, regen_mipmap: bool)
Apply the change to the pixel buffer of the texture
Sourcefn set_active_unit(&self, unit: u32)
fn set_active_unit(&self, unit: u32)
Set the active texture unit