Trait GenericTexture

Source
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§

Source

fn get_glcore(&self) -> &GLCore

Get the OpenGL core

Source

fn get_name(&self) -> u32

Get the internal name of the texture

Source

fn get_dim(&self) -> TextureDimension

Get the dimension of the texture

Source

fn get_width(&self) -> u32

Get width

Source

fn get_height(&self) -> u32

Get height

Source

fn get_depth(&self) -> u32

Get depth

Source

fn get_format(&self) -> TextureFormat

Get the texture internal format

Source

fn get_bytes_of_face(&self) -> usize

Get byte of face

Source

fn get_bytes_of_texture(&self) -> usize

Get byte of texture level 0

Source

fn has_mipmap(&self) -> bool

Get if have mipmap

Source

fn get_pixel_buffer(&self) -> Option<&dyn GenericPixelBuffer>

Get the pixel buffer

Source

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

Source

fn drop_pixel_buffer(&mut self)

Discard the PBO if not necessarily need it

Source

fn bind<'a>(&'a self) -> TextureBind<'a>

Bind the texture, using the RAII system to manage the binding state

Source

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§

Source

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

Source

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

Source

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

Source

fn pack_pixel_buffer(&self)

Read the pixels from the texture to the pixel buffer

Source

fn unpack_pixel_buffer(&self, regen_mipmap: bool)

Apply the change to the pixel buffer of the texture

Source

fn set_active_unit(&self, unit: u32)

Set the active texture unit

Implementors§

Source§

impl<B, BP> GenericTexture for Texture<B, BP>
where B: BufferVec<BP>, BP: BufferVecItem,