When switching from windowed mode to full screen in 3d , the view flickers. Why is that?

Godot Version

4.2.1 , windows , on board video card , 32 g ram

Question

This is what i see when changing between screen modes , this is simple scene .
run

as you can see the transition not smooth , am i doing it right ?

This is the code for changing screen modes :

using Godot;
using System;

public partial class player : CharacterBody3D
{
    private Camera3D camera;

    [Export]
    private float mouseSensitivity = 0.15f;
    private Vector3 RotationDegreesX;
    private Vector3 RotationDegreesY;
    private Vector3 CameraYClamp;

    public override void _Ready()
    {
        camera = GetNode<Camera3D>("Camera3D");
        Input.MouseMode = Input.MouseModeEnum.Captured;
        RotationDegreesX = new Vector3(0,0,0);
        RotationDegreesY = new Vector3(0, 0, 0);
        CameraYClamp = new Vector3(0,0,0);
        GD.Print("In ready ");
    }

    public override void _Input(InputEvent @event)
    {
        if(Input.IsActionJustPressed("quit"))
        {
            GetTree().Quit();
        }

        if(Input.IsActionJustPressed("restart")) {
            GetTree().ReloadCurrentScene();
        }
        if(Input.IsActionJustPressed("fullscreen"))
        {
            DisplayServer.WindowMode wm  = DisplayServer.WindowGetMode();
            if(wm.Equals(DisplayServer.WindowMode.Fullscreen))
            {
                DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
            } else if(wm.Equals(DisplayServer.WindowMode.Windowed))
            {
                DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
            }

        }

        if(@event is InputEventMouseMotion)
        {
            InputEventMouseMotion ev = (InputEventMouseMotion)@event;
            RotationDegreesX.Y = ev.Relative.X * mouseSensitivity;
            RotationDegreesY.X = ev.Relative.Y * mouseSensitivity;
           
            RotationDegrees -= RotationDegreesX;
            camera.RotationDegrees -= RotationDegreesY;
            CameraYClamp.X = Mathf.Clamp(camera.RotationDegrees.X, -90, 90);
            //camera.RotationDegrees = new Vector3(Mathf.Clamp(camera.RotationDegrees.X, -90, 90), 0, 0);
            camera.RotationDegrees = CameraYClamp;
            //camera.RotationDegrees.Clamp(new Vector3(-90.0f,0,0), new Vector3(90.0f, 0, 0));

            /*  RotationDegrees -= new Vector3(0, ev.Relative.X * mouseSensitivity,0);
              camera.RotationDegrees -= new Vector3(ev.Relative.Y * mouseSensitivity,0, 0);*/



        }
    }

    public override void _Process(double delta)
    {
            
    }

}

Thanks

It looks like it’s redrawing, because of the window size change. Not sure this can be mitigated. There are some project settings to maintain resolution regardless of window size. Maybe that could help?

When I played games and it lagged switching resolution sizes causes it to flicker, perhaps it has something to do with your device (I think this is unlikely personaly but its a possibility to consider)