pub fn new(override_dimension: Option<u32>, window_title: &str) -> Self {
        let event_loop = EventLoop::<()>::new();
        let dimension = override_dimension.unwrap_or(1024);
        let logical_size = LogicalSize::new(dimension, dimension);
        let window = WindowBuilder::new()
            .with_inner_size(logical_size)
            .with_title(window_title);
        let context = ContextBuilder::new(); // This is the place to enable multisampling and vsync if we want to
        let display = Display::new(window, context, &event_loop).unwrap();

        let current_monitor = display.gl_window().window().current_monitor();
        let scale_factor: f64 = current_monitor.scale_factor();

        // Create a closure that captures current screen information to use to
        // do local screen coordinate conversion for us.
        let inverse_half_dimension = 1.0 / (dimension as f32 * 0.5);
        let screen_to_opengl = Box::new(move |pos: PhysicalPosition<f64>| -> Vec2 {
            let logical_pos: (f64, f64) = pos.to_logical::<f64>(scale_factor).into();
            let x = (logical_pos.0 as f32 * inverse_half_dimension) - 1.0;
            let y = 1.0 - (logical_pos.1 as f32 * inverse_half_dimension);
            Vec2::new(x, y)
        });

        // For drawing shapes
        let shape_vertex_shader = r#"
        #version 140

        in vec2 position;
        in vec3 color;
        out vec3 v_color;

        uniform mat4 matrix;

        void main() {
            v_color = color;
            gl_Position = matrix * vec4(position, 0.0, 1.0);
        }
        "#;

        let shape_fragment_shader = r#"
            #version 140

            in vec3 v_color;
            out vec4 color;

            void main() {
                color = vec4(v_color, 1.0);
            }
        "#;

        let shape_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: shape_vertex_shader,
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: shape_fragment_shader,
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();

        let shader_circle_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: include_str!("shader/circle_solid_vertex.glsl"),
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: include_str!("shader/circle_solid_frag.glsl"),
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();

        // For drawing images
        let vertex_shader_img = r#"
            #version 140
            uniform mat4 matrix;
            in vec2 position;
            in vec2 tex_coords;
            in vec3 tint;
            in uint should_tint;
            out vec3 v_tint;
            out vec2 v_tex_coords;
            flat out uint v_should_tint;
            void main() {
                v_should_tint = should_tint;
                v_tint = tint;
                gl_Position = matrix * vec4(position, 0.0, 1.0);
                v_tex_coords = tex_coords;
            }
        "#;

        let fragment_shader_img = r#"
            #version 140
            uniform sampler2D tex;
            in vec2 v_tex_coords;
            in vec3 v_tint;
            flat in uint v_should_tint;
            out vec4 f_color;
            void main() {
                if ((texture(tex, v_tex_coords).a < 0.9) || (v_should_tint == 0u)) {
                    f_color = texture(tex, v_tex_coords);
                } else {
                    f_color = mix(texture(tex, v_tex_coords), vec4(v_tint, 1.0), 0.5);
                }
            }
        "#;

        let img_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: vertex_shader_img,
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: fragment_shader_img,
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();

        Self {
            event_loop,
            display,
            shape_program,
            shader_shape_program: shader_circle_program,
            img_program,
            screen_to_opengl,
            dimension,
            target: None,
        }
    }
/// By default, this will be a square window with a dimension of `1024` logical pixels.  You can
/// override the dimension by providing a value for override_dimension, for example: `Some(1200)`.
///
/// `window_title` is for the OS to use on the bar above your window.
By default, this will be a square window with a dimension of `1024` logical pixels.  You can
override the dimension by providing a value for override_dimension, for example: `Some(1200)`.

`window_title` is for the OS to use on the bar above your window.
By default this will be a square window with a dimension of ` 1024 ` logical pixels . You can override the dimension by providing a value for override_dimension for example : ` Some ( 1200 ) ` . ` window_title ` is for the OS to use on the bar above your window .
pub fn new(override_dimension: Option<u32>, window_title: &str) -> Self {
        let event_loop = EventLoop::<()>::new();
        let dimension = override_dimension.unwrap_or(1024);
        let logical_size = LogicalSize::new(dimension, dimension);
        let window = WindowBuilder::new()
            .with_inner_size(logical_size)
            .with_title(window_title);
        let context = ContextBuilder::new(); // This is the place to enable multisampling and vsync if we want to
        let display = Display::new(window, context, &event_loop).unwrap();
        let current_monitor = display.gl_window().window().current_monitor();
        let scale_factor: f64 = current_monitor.scale_factor();
        // Create a closure that captures current screen information to use to
        // do local screen coordinate conversion for us.
        let inverse_half_dimension = 1.0 / (dimension as f32 * 0.5);
        let screen_to_opengl = Box::new(move |pos: PhysicalPosition<f64>| -> Vec2 {
            let logical_pos: (f64, f64) = pos.to_logical::<f64>(scale_factor).into();
            let x = (logical_pos.0 as f32 * inverse_half_dimension) - 1.0;
            let y = 1.0 - (logical_pos.1 as f32 * inverse_half_dimension);
            Vec2::new(x, y)
        });
        // For drawing shapes
        let shape_vertex_shader = r#"
        #version 140
        in vec2 position;
        in vec3 color;
        out vec3 v_color;
        uniform mat4 matrix;
        void main() {
            v_color = color;
            gl_Position = matrix * vec4(position, 0.0, 1.0);
        }
        "#;
        let shape_fragment_shader = r#"
            #version 140
            in vec3 v_color;
            out vec4 color;
            void main() {
                color = vec4(v_color, 1.0);
            }
        "#;
        let shape_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: shape_vertex_shader,
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: shape_fragment_shader,
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();
        let shader_circle_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: include_str!("shader/circle_solid_vertex.glsl"),
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: include_str!("shader/circle_solid_frag.glsl"),
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();
        // For drawing images
        let vertex_shader_img = r#"
            #version 140
            uniform mat4 matrix;
            in vec2 position;
            in vec2 tex_coords;
            in vec3 tint;
            in uint should_tint;
            out vec3 v_tint;
            out vec2 v_tex_coords;
            flat out uint v_should_tint;
            void main() {
                v_should_tint = should_tint;
                v_tint = tint;
                gl_Position = matrix * vec4(position, 0.0, 1.0);
                v_tex_coords = tex_coords;
            }
        "#;
        let fragment_shader_img = r#"
            #version 140
            uniform sampler2D tex;
            in vec2 v_tex_coords;
            in vec3 v_tint;
            flat in uint v_should_tint;
            out vec4 f_color;
            void main() {
                if ((texture(tex, v_tex_coords).a < 0.9) || (v_should_tint == 0u)) {
                    f_color = texture(tex, v_tex_coords);
                } else {
                    f_color = mix(texture(tex, v_tex_coords), vec4(v_tint, 1.0), 0.5);
                }
            }
        "#;
        let img_program = Program::new(
            &display,
            ProgramCreationInput::SourceCode {
                vertex_shader: vertex_shader_img,
                tessellation_control_shader: None,
                tessellation_evaluation_shader: None,
                geometry_shader: None,
                fragment_shader: fragment_shader_img,
                transform_feedback_varyings: None,
                outputs_srgb: true,
                uses_point_size: true,
            },
        )
        .unwrap();
        Self {
            event_loop,
            display,
            shape_program,
            shader_shape_program: shader_circle_program,
            img_program,
            screen_to_opengl,
            dimension,
            target: None,
        }
    }
pub fn new ( override_dimension : Option < u32 > , window_title : & str ) -> Self { let event_loop = EventLoop :: < ( ) > :: new ( ) ; let dimension = override_dimension . unwrap_or ( 1024 ) ; let logical_size = LogicalSize :: new ( dimension , dimension ) ; let window = WindowBuilder :: new ( ) . with_inner_size ( logical_size ) . with_title ( window_title ) ; let context = ContextBuilder :: new ( ) ; // This is the place to enable multisampling and vsync if we want to let display = Display :: new ( window , context , & event_loop ) . unwrap ( ) ; let current_monitor = display . gl_window ( ) . window ( ) . current_monitor ( ) ; let scale_factor : f64 = current_monitor . scale_factor ( ) ; // Create a closure that captures current screen information to use to // do local screen coordinate conversion for us. let inverse_half_dimension = 1.0 / ( dimension as f32 * 0.5 ) ; let screen_to_opengl = Box :: new ( move | pos : PhysicalPosition < f64 > | -> Vec2 { let logical_pos : ( f64 , f64 ) = pos . to_logical :: < f64 > ( scale_factor ) . into ( ) ; let x = ( logical_pos . 0 as f32 * inverse_half_dimension ) - 1.0 ; let y = 1.0 - ( logical_pos . 1 as f32 * inverse_half_dimension ) ; Vec2 :: new ( x , y ) } ) ; // For drawing shapes let shape_vertex_shader = r#"
        #version 140

        in vec2 position;
        in vec3 color;
        out vec3 v_color;

        uniform mat4 matrix;

        void main() {
            v_color = color;
            gl_Position = matrix * vec4(position, 0.0, 1.0);
        }
        "# ; let shape_fragment_shader = r#"
            #version 140

            in vec3 v_color;
            out vec4 color;

            void main() {
                color = vec4(v_color, 1.0);
            }
        "# ; let shape_program = Program :: new ( & display , ProgramCreationInput :: SourceCode { vertex_shader : shape_vertex_shader , tessellation_control_shader : None , tessellation_evaluation_shader : None , geometry_shader : None , fragment_shader : shape_fragment_shader , transform_feedback_varyings : None , outputs_srgb : true , uses_point_size : true , } , ) . unwrap ( ) ; let shader_circle_program = Program :: new ( & display , ProgramCreationInput :: SourceCode { vertex_shader : include_str ! ( " " ) , tessellation_control_shader : None , tessellation_evaluation_shader : None , geometry_shader : None , fragment_shader : include_str ! ( " " ) , transform_feedback_varyings : None , outputs_srgb : true , uses_point_size : true , } , ) . unwrap ( ) ; // For drawing images let vertex_shader_img = r#"
            #version 140
            uniform mat4 matrix;
            in vec2 position;
            in vec2 tex_coords;
            in vec3 tint;
            in uint should_tint;
            out vec3 v_tint;
            out vec2 v_tex_coords;
            flat out uint v_should_tint;
            void main() {
                v_should_tint = should_tint;
                v_tint = tint;
                gl_Position = matrix * vec4(position, 0.0, 1.0);
                v_tex_coords = tex_coords;
            }
        "# ; let fragment_shader_img = r#"
            #version 140
            uniform sampler2D tex;
            in vec2 v_tex_coords;
            in vec3 v_tint;
            flat in uint v_should_tint;
            out vec4 f_color;
            void main() {
                if ((texture(tex, v_tex_coords).a < 0.9) || (v_should_tint == 0u)) {
                    f_color = texture(tex, v_tex_coords);
                } else {
                    f_color = mix(texture(tex, v_tex_coords), vec4(v_tint, 1.0), 0.5);
                }
            }
        "# ; let img_program = Program :: new ( & display , ProgramCreationInput :: SourceCode { vertex_shader : vertex_shader_img , tessellation_control_shader : None , tessellation_evaluation_shader : None , geometry_shader : None , fragment_shader : fragment_shader_img , transform_feedback_varyings : None , outputs_srgb : true , uses_point_size : true , } , ) . unwrap ( ) ; Self { event_loop , display , shape_program , shader_shape_program : shader_circle_program , img_program , screen_to_opengl , dimension , target : None , } }
By default, this will be a square window with a dimension of `1024` logical pixels.
By default this will be a square window with a dimension of ` 1024 ` logical pixels .
override_dimension
Option<u32>
window_title
&str
override_dimension
Option<u32>
window_title
&str