pub fn paint_primitives(
        &mut self,
        screen_size_px: [u32; 2],
        pixels_per_point: f32,
        clipped_primitives: &[egui::ClippedPrimitive],
    ) {
        crate::profile_function!();
        self.assert_not_destroyed();

        if let Some(ref mut post_process) = self.post_process {
            unsafe {
                post_process.begin(screen_size_px[0] as i32, screen_size_px[1] as i32);
                post_process.bind();
                self.gl.disable(glow::SCISSOR_TEST);
                self.gl
                    .viewport(0, 0, screen_size_px[0] as i32, screen_size_px[1] as i32);
                // use the same clear-color as was set for the screen framebuffer.
                self.gl.clear(glow::COLOR_BUFFER_BIT);
            }
        }
        let size_in_pixels = unsafe { self.prepare_painting(screen_size_px, pixels_per_point) };

        for egui::ClippedPrimitive {
            clip_rect,
            primitive,
        } in clipped_primitives
        {
            set_clip_rect(&self.gl, size_in_pixels, pixels_per_point, *clip_rect);

            match primitive {
                Primitive::Mesh(mesh) => {
                    self.paint_mesh(mesh);
                }
                Primitive::Callback(callback) => {
                    if callback.rect.is_positive() {
                        crate::profile_scope!("callback");
                        // Transform callback rect to physical pixels:
                        let rect_min_x = pixels_per_point * callback.rect.min.x;
                        let rect_min_y = pixels_per_point * callback.rect.min.y;
                        let rect_max_x = pixels_per_point * callback.rect.max.x;
                        let rect_max_y = pixels_per_point * callback.rect.max.y;

                        let rect_min_x = rect_min_x.round() as i32;
                        let rect_min_y = rect_min_y.round() as i32;
                        let rect_max_x = rect_max_x.round() as i32;
                        let rect_max_y = rect_max_y.round() as i32;

                        unsafe {
                            self.gl.viewport(
                                rect_min_x,
                                size_in_pixels.1 as i32 - rect_max_y,
                                rect_max_x - rect_min_x,
                                rect_max_y - rect_min_y,
                            );
                        }

                        let info = egui::PaintCallbackInfo {
                            viewport: callback.rect,
                            clip_rect: *clip_rect,
                            pixels_per_point,
                            screen_size_px,
                        };

                        callback.call(&info, self);

                        check_for_gl_error!(&self.gl, "callback");

                        // Restore state:
                        unsafe {
                            if let Some(ref mut post_process) = self.post_process {
                                post_process.bind();
                            }
                            self.prepare_painting(screen_size_px, pixels_per_point)
                        };
                    }
                }
            }
        }

        unsafe {
            self.vao.unbind(&self.gl);
            self.gl.bind_buffer(glow::ELEMENT_ARRAY_BUFFER, None);

            if let Some(ref post_process) = self.post_process {
                post_process.end();
            }

            self.gl.disable(glow::SCISSOR_TEST);

            check_for_gl_error!(&self.gl, "painting");
        }
    }
/// Main entry-point for painting a frame.
///
/// You should call `target.clear_color(..)` before
/// and `target.finish()` after this.
///
/// The following OpenGL features will be set:
/// - Scissor test will be enabled
/// - Cull face will be disabled
/// - Blend will be enabled
///
/// The scissor area and blend parameters will be changed.
///
/// As well as this, the following objects will be unset:
/// - Vertex Buffer
/// - Element Buffer
/// - Texture (and active texture will be set to 0)
/// - Program
///
/// Please be mindful of these effects when integrating into your program, and also be mindful
/// of the effects your program might have on this code. Look at the source if in doubt.
Main entry-point for painting a frame.

The following OpenGL features will be set:
Scissor test will be enabled
Cull face will be disabled
Blend will be enabled

The scissor area and blend parameters will be changed.

As well as this, the following objects will be unset:
Vertex Buffer
Element Buffer
Texture (and active texture will be set to 0)
Program

Please be mindful of these effects when integrating into your program, and also be mindful
of the effects your program might have on this code. Look at the source if in doubt.
Main entry - point for painting a frame . The following OpenGL features will be set : Scissor test will be enabled Cull face will be disabled Blend will be enabled The scissor area and blend parameters will be changed . As well as this the following objects will be unset : Vertex Buffer Element Buffer Texture ( and active texture will be set to 0 ) Program Please be mindful of these effects when integrating into your program and also be mindful of the effects your program might have on this code . Look at the source if in doubt .
pub fn paint_primitives(
        &mut self,
        screen_size_px: [u32; 2],
        pixels_per_point: f32,
        clipped_primitives: &[egui::ClippedPrimitive],
    ) {
        crate::profile_function!();
        self.assert_not_destroyed();
        if let Some(ref mut post_process) = self.post_process {
            unsafe {
                post_process.begin(screen_size_px[0] as i32, screen_size_px[1] as i32);
                post_process.bind();
                self.gl.disable(glow::SCISSOR_TEST);
                self.gl
                    .viewport(0, 0, screen_size_px[0] as i32, screen_size_px[1] as i32);
                // use the same clear-color as was set for the screen framebuffer.
                self.gl.clear(glow::COLOR_BUFFER_BIT);
            }
        }
        let size_in_pixels = unsafe { self.prepare_painting(screen_size_px, pixels_per_point) };
        for egui::ClippedPrimitive {
            clip_rect,
            primitive,
        } in clipped_primitives
        {
            set_clip_rect(&self.gl, size_in_pixels, pixels_per_point, *clip_rect);
            match primitive {
                Primitive::Mesh(mesh) => {
                    self.paint_mesh(mesh);
                }
                Primitive::Callback(callback) => {
                    if callback.rect.is_positive() {
                        crate::profile_scope!("callback");
                        // Transform callback rect to physical pixels:
                        let rect_min_x = pixels_per_point * callback.rect.min.x;
                        let rect_min_y = pixels_per_point * callback.rect.min.y;
                        let rect_max_x = pixels_per_point * callback.rect.max.x;
                        let rect_max_y = pixels_per_point * callback.rect.max.y;
                        let rect_min_x = rect_min_x.round() as i32;
                        let rect_min_y = rect_min_y.round() as i32;
                        let rect_max_x = rect_max_x.round() as i32;
                        let rect_max_y = rect_max_y.round() as i32;
                        unsafe {
                            self.gl.viewport(
                                rect_min_x,
                                size_in_pixels.1 as i32 - rect_max_y,
                                rect_max_x - rect_min_x,
                                rect_max_y - rect_min_y,
                            );
                        }
                        let info = egui::PaintCallbackInfo {
                            viewport: callback.rect,
                            clip_rect: *clip_rect,
                            pixels_per_point,
                            screen_size_px,
                        };
                        callback.call(&info, self);
                        check_for_gl_error!(&self.gl, "callback");
                        // Restore state:
                        unsafe {
                            if let Some(ref mut post_process) = self.post_process {
                                post_process.bind();
                            }
                            self.prepare_painting(screen_size_px, pixels_per_point)
                        };
                    }
                }
            }
        }
        unsafe {
            self.vao.unbind(&self.gl);
            self.gl.bind_buffer(glow::ELEMENT_ARRAY_BUFFER, None);
            if let Some(ref post_process) = self.post_process {
                post_process.end();
            }
            self.gl.disable(glow::SCISSOR_TEST);
            check_for_gl_error!(&self.gl, "painting");
        }
    }
pub fn paint_primitives ( & mut self , screen_size_px : [ u32 ; 2 ] , pixels_per_point : f32 , clipped_primitives : & [ egui :: ClippedPrimitive ] , ) { crate :: profile_function ! ( ) ; self . assert_not_destroyed ( ) ; if let Some ( ref mut post_process ) = self . post_process { unsafe { post_process . begin ( screen_size_px [ 0 ] as i32 , screen_size_px [ 1 ] as i32 ) ; post_process . bind ( ) ; self . gl . disable ( glow :: SCISSOR_TEST ) ; self . gl . viewport ( 0 , 0 , screen_size_px [ 0 ] as i32 , screen_size_px [ 1 ] as i32 ) ; // use the same clear-color as was set for the screen framebuffer. self . gl . clear ( glow :: COLOR_BUFFER_BIT ) ; } } let size_in_pixels = unsafe { self . prepare_painting ( screen_size_px , pixels_per_point ) } ; for egui :: ClippedPrimitive { clip_rect , primitive , } in clipped_primitives { set_clip_rect ( & self . gl , size_in_pixels , pixels_per_point , * clip_rect ) ; match primitive { Primitive :: Mesh ( mesh ) => { self . paint_mesh ( mesh ) ; } Primitive :: Callback ( callback ) => { if callback . rect . is_positive ( ) { crate :: profile_scope ! ( " " ) ; // Transform callback rect to physical pixels: let rect_min_x = pixels_per_point * callback . rect . min . x ; let rect_min_y = pixels_per_point * callback . rect . min . y ; let rect_max_x = pixels_per_point * callback . rect . max . x ; let rect_max_y = pixels_per_point * callback . rect . max . y ; let rect_min_x = rect_min_x . round ( ) as i32 ; let rect_min_y = rect_min_y . round ( ) as i32 ; let rect_max_x = rect_max_x . round ( ) as i32 ; let rect_max_y = rect_max_y . round ( ) as i32 ; unsafe { self . gl . viewport ( rect_min_x , size_in_pixels . 1 as i32 - rect_max_y , rect_max_x - rect_min_x , rect_max_y - rect_min_y , ) ; } let info = egui :: PaintCallbackInfo { viewport : callback . rect , clip_rect : * clip_rect , pixels_per_point , screen_size_px , } ; callback . call ( & info , self ) ; check_for_gl_error ! ( self gl " " ) ; // Restore state: unsafe { if let Some ( ref mut post_process ) = self . post_process { post_process . bind ( ) ; } self . prepare_painting ( screen_size_px , pixels_per_point ) } ; } } } } unsafe { self . vao . unbind ( & self . gl ) ; self . gl . bind_buffer ( glow :: ELEMENT_ARRAY_BUFFER , None ) ; if let Some ( ref post_process ) = self . post_process { post_process . end ( ) ; } self . gl . disable ( glow :: SCISSOR_TEST ) ; check_for_gl_error ! ( self gl " " ) ; } }
Main entry-point for painting a frame.
Main entry - point for painting a frame .
&mut self
screen_size_px
[u32; 2]
pixels_per_point
f32
clipped_primitives
&[egui::ClippedPrimitive]
&mut self
screen_size_px
[u32; 2]
pixels_per_point
f32
clipped_primitives
&[egui::ClippedPrimitive]