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>, ) -> Result<(), TextureError>; fn drop_pixel_buffer(&mut self); fn bind<'a>(&'a self) -> Result<TextureBind<'a>, TextureError>; fn bind_face<'a>( &'a self, face: CubeMapFaces, ) -> Result<TextureBind<'a>, TextureError>; // Provided methods fn map_buffer<'a>( &'a mut self, access: MapAccess, ) -> Result<Option<(BufferBind<'a>, BufferMapping<'a>, *mut c_void)>, TextureError> { ... } unsafe fn download_texture( &self, data: *mut c_void, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, ) -> Result<(), TextureError> { ... } unsafe fn upload_texture( &self, data: *const c_void, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, regen_mipmap: bool, ) -> Result<(), TextureError> { ... } fn pack_pixel_buffer(&self) -> Result<(), TextureError> { ... } fn unpack_pixel_buffer( &self, regen_mipmap: bool, ) -> Result<(), TextureError> { ... } fn set_active_unit(&self, unit: u32) -> Result<(), TextureError> { ... }
}
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>, ) -> Result<(), TextureError>

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) -> Result<TextureBind<'a>, TextureError>

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

Source

fn bind_face<'a>( &'a self, face: CubeMapFaces, ) -> Result<TextureBind<'a>, TextureError>

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, ) -> Result<Option<(BufferBind<'a>, BufferMapping<'a>, *mut c_void)>, TextureError>

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, ) -> Result<(), TextureError>

Retrieve the pixels from the texture to the specified data pointer regardless of is currently using a PBO or not

§Safety

When binding a pixel pack buffer, the pointer data refers to the offset of the buffer in bytes. When not bound to any pixel pack buffers, the pointer data is the pointer to your image buffer in the system memory.

Source

unsafe fn upload_texture( &self, data: *const c_void, buffer_channel_type: ChannelType, buffer_component_type: ComponentType, regen_mipmap: bool, ) -> Result<(), TextureError>

Load the texture with the specified data pointer regardless of is currently using a PBO or not

§Safety

When binding a pixel unpack buffer, the pointer data refers to the offset of the buffer in bytes. When not bound to any pixel unpack buffers, the pointer data is the pointer to your image buffer in the system memory.

Source

fn pack_pixel_buffer(&self) -> Result<(), TextureError>

Read the pixels from the texture to the pixel buffer

Source

fn unpack_pixel_buffer(&self, regen_mipmap: bool) -> Result<(), TextureError>

Apply the change to the pixel buffer of the texture

Source

fn set_active_unit(&self, unit: u32) -> Result<(), TextureError>

Set the active texture unit

Implementors§

Source§

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