rust/lib-hedgewars-engine/src/render/gl.rs
changeset 15286 16bd389fc735
parent 15285 6382a14c9e83
child 15289 fd20e0a134af
equal deleted inserted replaced
15285:6382a14c9e83 15286:16bd389fc735
    61         gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, filter as i32);
    61         gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, filter as i32);
    62     }
    62     }
    63 }
    63 }
    64 
    64 
    65 impl Texture2D {
    65 impl Texture2D {
    66     pub fn new(size: Size, internal_format: u32, format: u32, ty: u32, filter: u32) -> Self {
    66     pub fn new(size: Size, internal_format: u32, filter: u32) -> Self {
    67         if let Some(handle) = new_texture() {
    67         if let Some(handle) = new_texture() {
    68             unsafe {
    68             unsafe {
    69                 gl::BindTexture(gl::TEXTURE_2D, handle.get());
    69                 gl::BindTexture(gl::TEXTURE_2D, handle.get());
    70                 gl::TexImage2D(
    70                 gl::TexImage2D(
    71                     gl::TEXTURE_2D,
    71                     gl::TEXTURE_2D,
    72                     0,
    72                     0,
    73                     internal_format as i32,
    73                     internal_format as i32,
    74                     size.width as i32,
    74                     size.width as i32,
    75                     size.height as i32,
    75                     size.height as i32,
    76                     0,
    76                     0,
    77                     format as u32,
    77                     gl::RGBA,
    78                     ty,
    78                     gl::UNSIGNED_BYTE,
    79                     std::ptr::null(),
    79                     std::ptr::null(),
    80                 )
    80                 )
    81             }
    81             }
    82 
    82 
    83             tex_params(filter);
    83             tex_params(filter);