fn insert_inner(&mut self,
                    glyph: &RasterizedGlyph,
                    active_tex: &mut u32)
                    -> Glyph
    {
        let offset_y = self.row_baseline;
        let offset_x = self.row_extent;
        let height = glyph.height as i32;
        let width = glyph.width as i32;

        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, self.id);

            // Load data into OpenGL
            gl::TexSubImage2D(
                gl::TEXTURE_2D,
                0,
                offset_x,
                offset_y,
                width,
                height,
                gl::RGB,
                gl::UNSIGNED_BYTE,
                glyph.buf.as_ptr() as *const _
            );

            gl::BindTexture(gl::TEXTURE_2D, 0);
            *active_tex = 0;
        }

        // Update Atlas state
        self.row_extent = offset_x + width;
        if height > self.row_tallest {
            self.row_tallest = height;
        }

        // Generate UV coordinates
        let uv_bot = offset_y as f32 / self.height as f32;
        let uv_left = offset_x as f32 / self.width as f32;
        let uv_height = height as f32 / self.height as f32;
        let uv_width = width as f32 / self.width as f32;

        Glyph {
            tex_id: self.id,
            top: glyph.top as f32,
            width: width as f32,
            height: height as f32,
            left: glyph.left as f32,
            uv_bot,
            uv_left,
            uv_width,
            uv_height,
        }
    }
/// Insert the glyph without checking for room
///
/// Internal function for use once atlas has been checked for space. GL
/// errors could still occur at this point if we were checking for them;
/// hence, the Result.
Insert the glyph without checking for room
Internal function for use once atlas has been checked for space. GL
errors could still occur at this point if we were checking for them;
hence, the Result.
Insert the glyph without checking for room Internal function for use once atlas has been checked for space . GL errors could still occur at this point if we were checking for them ; hence the Result .
fn insert_inner(&mut self,
                    glyph: &RasterizedGlyph,
                    active_tex: &mut u32)
                    -> Glyph
    {
        let offset_y = self.row_baseline;
        let offset_x = self.row_extent;
        let height = glyph.height as i32;
        let width = glyph.width as i32;
        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, self.id);
            // Load data into OpenGL
            gl::TexSubImage2D(
                gl::TEXTURE_2D,
                0,
                offset_x,
                offset_y,
                width,
                height,
                gl::RGB,
                gl::UNSIGNED_BYTE,
                glyph.buf.as_ptr() as *const _
            );
            gl::BindTexture(gl::TEXTURE_2D, 0);
            *active_tex = 0;
        }
        // Update Atlas state
        self.row_extent = offset_x + width;
        if height > self.row_tallest {
            self.row_tallest = height;
        }
        // Generate UV coordinates
        let uv_bot = offset_y as f32 / self.height as f32;
        let uv_left = offset_x as f32 / self.width as f32;
        let uv_height = height as f32 / self.height as f32;
        let uv_width = width as f32 / self.width as f32;
        Glyph {
            tex_id: self.id,
            top: glyph.top as f32,
            width: width as f32,
            height: height as f32,
            left: glyph.left as f32,
            uv_bot,
            uv_left,
            uv_width,
            uv_height,
        }
    }
fn insert_inner ( & mut self , glyph : & RasterizedGlyph , active_tex : & mut u32 ) -> Glyph { let offset_y = self . row_baseline ; let offset_x = self . row_extent ; let height = glyph . height as i32 ; let width = glyph . width as i32 ; unsafe { gl :: BindTexture ( gl :: TEXTURE_2D , self . id ) ; // Load data into OpenGL gl :: TexSubImage2D ( gl :: TEXTURE_2D , 0 , offset_x , offset_y , width , height , gl :: RGB , gl :: UNSIGNED_BYTE , glyph . buf . as_ptr ( ) as * const _ ) ; gl :: BindTexture ( gl :: TEXTURE_2D , 0 ) ; * active_tex = 0 ; } // Update Atlas state self . row_extent = offset_x + width ; if height > self . row_tallest { self . row_tallest = height ; } // Generate UV coordinates let uv_bot = offset_y as f32 / self . height as f32 ; let uv_left = offset_x as f32 / self . width as f32 ; let uv_height = height as f32 / self . height as f32 ; let uv_width = width as f32 / self . width as f32 ; Glyph { tex_id : self . id , top : glyph . top as f32 , width : width as f32 , height : height as f32 , left : glyph . left as f32 , uv_bot , uv_left , uv_width , uv_height , } }
Insert the glyph without checking for room
Internal function for use once atlas has been checked for space.
Insert the glyph without checking for room Internal function for use once atlas has been checked for space .
&mut self
glyph
&RasterizedGlyph
active_tex
&mut u32
&mut self
glyph
&RasterizedGlyph
active_tex
&mut u32