+fn gen_tex(fname : String, _id : &mut GLuint) {
+ let img : image::DynamicImage = image::open(&std::path::Path::new(&fname)).ok().expect("Can't open image.\n");
+ let (_w, _h) = img.dimensions();
+
+ unsafe {
+ gl::GenTextures(1, _id);
+ gl::BindTexture(gl::TEXTURE_2D, *_id);
+ gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::REPEAT as i32);
+ gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::REPEAT as i32);
+ gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR as i32);
+ gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR as i32);
+ gl::TexImage2D(gl::TEXTURE_2D, 0, gl::RGBA as i32,
+ _w as i32, _h as i32, 0,
+ gl::RGBA, gl::UNSIGNED_BYTE,
+ img.to_rgba().into_raw().as_ptr() as *const std::ffi::c_void);
+ gl::BindTexture(gl::TEXTURE_2D, 0);
+ }
+}
+