pub fn load_data(&mut self, data: &[u8], width: u32, height: u32, format: TextureFormat) {
        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, self.texture);
            gl::TexImage2D(gl::TEXTURE_2D, 0, // Mipmap level
                           format as GLint, // Internal format
                           width as GLsizei, height as GLsizei, 0, // Size and border
                           format.unsized_format(), // Data format
                           gl::UNSIGNED_BYTE, data.as_ptr() as *const GLvoid);
        }

        self.width = width;
        self.height = height;
        self.format = format;
    }
/// Directly loads some color data into a texture. This function does not check to ensure that
/// the data is in the correct format, so you have to manually ensure that it is valid. This
/// function is intended for creating small debug textures.
Directly loads some color data into a texture. This function does not check to ensure that
the data is in the correct format, so you have to manually ensure that it is valid. This
function is intended for creating small debug textures.
Directly loads some color data into a texture . This function does not check to ensure that the data is in the correct format so you have to manually ensure that it is valid . This function is intended for creating small debug textures .
pub fn load_data(&mut self, data: &[u8], width: u32, height: u32, format: TextureFormat) {
        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, self.texture);
            gl::TexImage2D(gl::TEXTURE_2D, 0, // Mipmap level
                           format as GLint, // Internal format
                           width as GLsizei, height as GLsizei, 0, // Size and border
                           format.unsized_format(), // Data format
                           gl::UNSIGNED_BYTE, data.as_ptr() as *const GLvoid);
        }
        self.width = width;
        self.height = height;
        self.format = format;
    }
pub fn load_data ( & mut self , data : & [ u8 ] , width : u32 , height : u32 , format : TextureFormat ) { unsafe { gl :: BindTexture ( gl :: TEXTURE_2D , self . texture ) ; gl :: TexImage2D ( gl :: TEXTURE_2D , 0 , // Mipmap level format as GLint , // Internal format width as GLsizei , height as GLsizei , 0 , // Size and border format . unsized_format ( ) , // Data format gl :: UNSIGNED_BYTE , data . as_ptr ( ) as * const GLvoid ) ; } self . width = width ; self . height = height ; self . format = format ; }
Directly loads some color data into a texture.
Directly loads some color data into a texture .
&mut self
data
&[u8]
width
u32
height
u32
format
TextureFormat
&mut self
data
&[u8]
width
u32
height
u32
format
TextureFormat