rust/lib-hedgewars-engine/src/render/gl.rs
changeset 15289 fd20e0a134af
parent 15286 16bd389fc735
child 15760 ff1432e873bd
equal deleted inserted replaced
15288:0f734fa371e1 15289:fd20e0a134af
   132                 gl::TexSubImage2D(
   132                 gl::TexSubImage2D(
   133                     gl::TEXTURE_2D,
   133                     gl::TEXTURE_2D,
   134                     0,             // texture level
   134                     0,             // texture level
   135                     region.left(), // texture region
   135                     region.left(), // texture region
   136                     region.top(),
   136                     region.top(),
   137                     region.right(),
   137                     region.width() as i32,
   138                     region.bottom(),
   138                     region.height() as i32,
   139                     format,                    // data format
   139                     format,                    // data format
   140                     ty,                        // data type
   140                     ty,                        // data type
   141                     data.as_ptr() as *const _, // data ptr
   141                     data.as_ptr() as *const _, // data ptr
       
   142                 );
       
   143             }
       
   144         }
       
   145     }
       
   146 
       
   147     pub fn retrieve(&self, data: &mut [u8]) {
       
   148         if let Some(handle) = self.handle {
       
   149             unsafe {
       
   150                 gl::BindTexture(gl::TEXTURE_2D, handle.get());
       
   151                 gl::GetTexImage(
       
   152                     gl::TEXTURE_2D,
       
   153                     0,                           // texture level
       
   154                     gl::RGBA,                    // data format
       
   155                     gl::UNSIGNED_BYTE,           // data type
       
   156                     data.as_mut_ptr() as *mut _, // data ptr
   142                 );
   157                 );
   143             }
   158             }
   144         }
   159         }
   145     }
   160     }
   146 }
   161 }