resize Subroutine

private subroutine resize(self, width, height, pixel_ratio)

The host window was resized (framebuffer pixels), and pixel_ratio: its framebuffer pixels per window unit (Qt's devicePixelRatio), if it may have changed (the window moved to a screen of another scale, or the display's scaling changed: sizes in window units, such as line widths, markers and labels, are scaled by it). Once the scene is shown, a frame of the new size is rendered at once (call this from the host's resize event), so that the window isn't shown stretched or blank while it is resized.

Type Bound

WindowProxy

Arguments

Type IntentOptional Attributes Name
class(WindowProxy), intent(inout) :: self
integer, intent(in) :: width

framebuffer pixels

integer, intent(in) :: height

framebuffer pixels

real(kind=wp), intent(in), optional :: pixel_ratio

framebuffer pixels per window unit


Calls

proc~~resize~~CallsGraph proc~resize WindowProxy%resize interface~vkf_viewer_resize vkf_viewer_resize proc~resize->interface~vkf_viewer_resize interface~vkf_viewer_set_pixel_ratio vkf_viewer_set_pixel_ratio proc~resize->interface~vkf_viewer_set_pixel_ratio proc~frame WindowProxy%frame proc~resize->proc~frame interface~vkf_viewer_add_node vkf_viewer_add_node proc~frame->interface~vkf_viewer_add_node interface~vkf_viewer_frame_begin vkf_viewer_frame_begin proc~frame->interface~vkf_viewer_frame_begin interface~vkf_viewer_frame_draw vkf_viewer_frame_draw proc~frame->interface~vkf_viewer_frame_draw interface~vkf_viewer_record_frames vkf_viewer_record_frames proc~frame->interface~vkf_viewer_record_frames proc~count_frame count_frame proc~frame->proc~count_frame proc~create_huds create_huds proc~frame->proc~create_huds proc~dispatch_events dispatch_events proc~frame->proc~dispatch_events proc~fm_frame FrameManager%fm_frame proc~frame->proc~fm_frame proc~handler_before_draw WindowEventHandler%handler_before_draw proc~frame->proc~handler_before_draw proc~handler_before_update WindowEventHandler%handler_before_update proc~frame->proc~handler_before_update proc~is_open WindowProxy%is_open proc~frame->proc~is_open proc~node ReferenceFrame%node proc~frame->proc~node proc~place_camera place_camera proc~frame->proc~place_camera proc~realize ReferenceFrame%realize proc~frame->proc~realize proc~stop_recording WindowProxy%stop_recording proc~frame->proc~stop_recording proc~sync ReferenceFrame%sync proc~frame->proc~sync proc~track_view track_view proc~frame->proc~track_view proc~update_huds update_huds proc~frame->proc~update_huds proc~update_window_light update_window_light proc~frame->proc~update_window_light proc~update~3 SimulationClock%update proc~frame->proc~update~3 proc~wall_time wall_time proc~frame->proc~wall_time proc~window_wall window_wall proc~frame->proc~window_wall proc~count_frame->proc~wall_time proc~create_hud create_hud proc~create_huds->proc~create_hud proc~dispatch_events->proc~is_open interface~vkf_viewer_events vkf_viewer_events proc~dispatch_events->interface~vkf_viewer_events proc~dispatch_event dispatch_event proc~dispatch_events->proc~dispatch_event proc~place_camera->proc~fm_frame interface~vkf_viewer_get_look_at vkf_viewer_get_look_at proc~place_camera->interface~vkf_viewer_get_look_at interface~vkf_viewer_orthographic vkf_viewer_orthographic proc~place_camera->interface~vkf_viewer_orthographic interface~vkf_viewer_perspective vkf_viewer_perspective proc~place_camera->interface~vkf_viewer_perspective interface~vkf_viewer_set_view_transform vkf_viewer_set_view_transform proc~place_camera->interface~vkf_viewer_set_view_transform proc~aspect_ratio aspect_ratio proc~place_camera->proc~aspect_ratio proc~current_view WindowProxy%current_view proc~place_camera->proc~current_view proc~field_of_view View%field_of_view proc~place_camera->proc~field_of_view proc~fly fly proc~place_camera->proc~fly proc~home View%home proc~place_camera->proc~home proc~is_valid~2 View%is_valid proc~place_camera->proc~is_valid~2 proc~orthographic_bounds View%orthographic_bounds proc~place_camera->proc~orthographic_bounds proc~projection_type View%projection_type proc~place_camera->proc~projection_type proc~put_camera put_camera proc~place_camera->proc~put_camera proc~reset_view View%reset_view proc~place_camera->proc~reset_view proc~save_state View%save_state proc~place_camera->proc~save_state proc~saved_state View%saved_state proc~place_camera->proc~saved_state proc~set_view_frame View%set_view_frame proc~place_camera->proc~set_view_frame proc~start_flight start_flight proc~place_camera->proc~start_flight proc~take_camera View%take_camera proc~place_camera->proc~take_camera proc~take_reset View%take_reset proc~place_camera->proc~take_reset proc~world_to_view View%world_to_view proc~place_camera->proc~world_to_view proc~realize->proc~realize proc~realize->proc~sync interface~vkf_node_add_child vkf_node_add_child proc~realize->interface~vkf_node_add_child interface~vkf_switch_create vkf_switch_create proc~realize->interface~vkf_switch_create interface~vkf_switch_set vkf_switch_set proc~realize->interface~vkf_switch_set interface~vkf_transform_create vkf_transform_create proc~realize->interface~vkf_transform_create proc~build_contents ReferenceFrame%build_contents proc~realize->proc~build_contents proc~build_decorations build_decorations proc~realize->proc~build_decorations proc~build_light build_light proc~realize->proc~build_light proc~check_status check_status proc~realize->proc~check_status proc~stop_recording->proc~wall_time proc~stop_recording->proc~window_wall interface~vkf_viewer_record_stop vkf_viewer_record_stop proc~stop_recording->interface~vkf_viewer_record_stop proc~set_time~4 SimulationClock%set_time proc~stop_recording->proc~set_time~4 proc~synchronized_to SimulationClock%synchronized_to proc~stop_recording->proc~synchronized_to proc~sync->proc~sync interface~vkf_transform_set_matrix vkf_transform_set_matrix proc~sync->interface~vkf_transform_set_matrix proc~sync->proc~check_status proc~local_matrix ReferenceFrame%local_matrix proc~sync->proc~local_matrix proc~track_view->interface~vkf_viewer_set_view_transform proc~track_view->proc~current_view proc~track_view->proc~world_to_view interface~vkf_label_set_color vkf_label_set_color proc~update_huds->interface~vkf_label_set_color interface~vkf_label_set_text vkf_label_set_text proc~update_huds->interface~vkf_label_set_text interface~vkf_node_delete vkf_node_delete proc~update_huds->interface~vkf_node_delete interface~vkf_viewer_hud_remove vkf_viewer_hud_remove proc~update_huds->interface~vkf_viewer_hud_remove proc~alignment HUDText%alignment proc~update_huds->proc~alignment proc~color HUDText%color proc~update_huds->proc~color proc~update_huds->proc~create_hud proc~font HUDText%font proc~update_huds->proc~font proc~label_set_layout label_set_layout proc~update_huds->proc~label_set_layout proc~position HUDText%position proc~update_huds->proc~position proc~revision HUDText%revision proc~update_huds->proc~revision proc~text~2 HUDText%text proc~update_huds->proc~text~2 interface~vkf_viewer_light_enable vkf_viewer_light_enable proc~update_window_light->interface~vkf_viewer_light_enable proc~has_light_source ReferenceFrame%has_light_source proc~update_window_light->proc~has_light_source proc~now now proc~update~3->proc~now proc~update~3->proc~set_time~4 proc~window_wall->proc~wall_time interface~vkf_viewer_size vkf_viewer_size proc~aspect_ratio->interface~vkf_viewer_size proc~build_decorations->interface~vkf_node_add_child proc~build_decorations->interface~vkf_switch_create proc~build_decorations->proc~check_status proc~make_axis make_axis proc~build_decorations->proc~make_axis proc~make_name_label make_name_label proc~build_decorations->proc~make_name_label proc~reposition_axes ReferenceFrame%reposition_axes proc~build_decorations->proc~reposition_axes proc~update_switches update_switches proc~build_decorations->proc~update_switches proc~build_light->interface~vkf_node_add_child proc~build_light->interface~vkf_switch_create proc~build_light->proc~check_status interface~vkf_light_create vkf_light_create proc~build_light->interface~vkf_light_create proc~apply_light apply_light proc~build_light->proc~apply_light proc~create_hud->proc~alignment proc~create_hud->proc~color proc~create_hud->proc~font proc~create_hud->proc~position proc~create_hud->proc~revision proc~create_hud->proc~text~2 interface~vkf_viewer_hud_add vkf_viewer_hud_add proc~create_hud->interface~vkf_viewer_hud_add proc~label_create label_create proc~create_hud->proc~label_create proc~dispatch_event->proc~is_open proc~default_key default_key proc~dispatch_event->proc~default_key proc~drag_handle drag_handle proc~dispatch_event->proc~drag_handle proc~grab_handle grab_handle proc~dispatch_event->proc~grab_handle proc~handler_button_press WindowEventHandler%handler_button_press proc~dispatch_event->proc~handler_button_press proc~handler_button_release WindowEventHandler%handler_button_release proc~dispatch_event->proc~handler_button_release proc~handler_key_press WindowEventHandler%handler_key_press proc~dispatch_event->proc~handler_key_press proc~handler_key_release WindowEventHandler%handler_key_release proc~dispatch_event->proc~handler_key_release proc~handler_mouse_motion WindowEventHandler%handler_mouse_motion proc~dispatch_event->proc~handler_mouse_motion proc~hover_handle hover_handle proc~dispatch_event->proc~hover_handle proc~release_handle release_handle proc~dispatch_event->proc~release_handle proc~fly->proc~window_wall proc~fly->proc~put_camera proc~fly->proc~world_to_view proc~camera_between camera_between proc~fly->proc~camera_between proc~rigid_inverse rigid_inverse proc~fly->proc~rigid_inverse proc~transform_camera transform_camera proc~fly->proc~transform_camera proc~has_light_source->proc~has_light_source proc~home->proc~world_to_view proc~bound ReferenceFrame%bound proc~home->proc~bound proc~frame_to_root frame_to_root proc~home->proc~frame_to_root interface~vkf_label_set_layout vkf_label_set_layout proc~label_set_layout->interface~vkf_label_set_layout proc~vsg_alignment vsg_alignment proc~label_set_layout->proc~vsg_alignment proc~frame_matrix frame_matrix proc~local_matrix->proc~frame_matrix proc~now->proc~wall_time interface~vkf_viewer_look_at vkf_viewer_look_at proc~put_camera->interface~vkf_viewer_look_at proc~set_time~4->proc~now proc~set_time~4->proc~set_time~4 proc~start_flight->proc~window_wall proc~world_to_view->proc~frame_to_root proc~identity_matrix identity_matrix proc~world_to_view->proc~identity_matrix proc~quat_from_vectors quat_from_vectors proc~world_to_view->proc~quat_from_vectors proc~quat_to_matrix quat_to_matrix proc~world_to_view->proc~quat_to_matrix proc~world_to_view->proc~rigid_inverse proc~rotated rotated proc~world_to_view->proc~rotated proc~translation_matrix translation_matrix proc~world_to_view->proc~translation_matrix proc~apply_light->proc~check_status interface~vkf_light_set vkf_light_set proc~apply_light->interface~vkf_light_set proc~camera_between->proc~quat_to_matrix proc~camera_orientation camera_orientation proc~camera_between->proc~camera_orientation proc~quat_normalize quat_normalize proc~camera_between->proc~quat_normalize proc~quat_slerp quat_slerp proc~camera_between->proc~quat_slerp proc~default_key->proc~current_view proc~default_key->proc~reset_view proc~next_view WindowProxy%next_view proc~default_key->proc~next_view proc~previous_view WindowProxy%previous_view proc~default_key->proc~previous_view proc~cursor_ray WindowProxy%cursor_ray proc~drag_handle->proc~cursor_ray proc~drag DragHandle%drag proc~drag_handle->proc~drag proc~handler_handle_drag WindowEventHandler%handler_handle_drag proc~drag_handle->proc~handler_handle_drag proc~frame_matrix->proc~quat_to_matrix proc~frame_to_root->proc~rigid_inverse proc~world_matrix ReferenceFrame%world_matrix proc~frame_to_root->proc~world_matrix proc~grab_handle->proc~cursor_ray proc~grab DragHandle%grab proc~grab_handle->proc~grab proc~grab_handle->proc~handler_handle_drag draggable draggable proc~hover_handle->draggable interface~vkf_viewer_set_grab vkf_viewer_set_grab proc~hover_handle->interface~vkf_viewer_set_grab priority priority proc~hover_handle->priority proc~handles_shown handles_shown proc~hover_handle->proc~handles_shown proc~set_hovered DragHandle%set_hovered proc~hover_handle->proc~set_hovered proc~window_pick WindowProxy%window_pick proc~hover_handle->proc~window_pick proc~label_create->proc~vsg_alignment interface~vkf_label_create vkf_label_create proc~label_create->interface~vkf_label_create proc~get_font get_font proc~label_create->proc~get_font proc~make_axis->proc~label_create proc~make_axis->proc~update_switches proc~arrow_create arrow_create proc~make_axis->proc~arrow_create proc~axis_label ReferenceFrame%axis_label proc~make_axis->proc~axis_label proc~label_font ReferenceFrame%label_font proc~make_axis->proc~label_font proc~replace_child replace_child proc~make_axis->proc~replace_child proc~make_name_label->proc~check_status proc~make_name_label->proc~label_create proc~make_name_label->proc~update_switches interface~vkf_label_set_on_top vkf_label_set_on_top proc~make_name_label->interface~vkf_label_set_on_top proc~make_name_label->proc~label_font proc~name ReferenceFrame%name proc~make_name_label->proc~name proc~make_name_label->proc~replace_child proc~cross cross proc~quat_from_vectors->proc~cross proc~quat_from_vectors->proc~quat_normalize proc~release_handle->proc~is_open proc~release_handle->proc~hover_handle proc~release_handle->proc~handler_handle_drag proc~release DragHandle%release proc~release_handle->proc~release proc~reposition_axes->proc~bound proc~translation_matrix->proc~identity_matrix proc~update_switches->interface~vkf_switch_set proc~update_switches->proc~check_status interface~vkf_mesh_create vkf_mesh_create proc~arrow_create->interface~vkf_mesh_create proc~arrow arrow proc~arrow_create->proc~arrow proc~arrow_size arrow_size proc~arrow_create->proc~arrow_size proc~mesh_arrays mesh_arrays proc~arrow_create->proc~mesh_arrays proc~camera_orientation->proc~cross proc~quat_from_matrix quat_from_matrix proc~camera_orientation->proc~quat_from_matrix proc~ray ray proc~cursor_ray->proc~ray proc~view_camera view_camera proc~cursor_ray->proc~view_camera proc~drag->proc~world_matrix move_handle_point move_handle_point proc~drag->move_handle_point proc~constrained constrained proc~drag->proc~constrained interface~vkf_font_read vkf_font_read proc~get_font->interface~vkf_font_read proc~find_font find_font proc~get_font->proc~find_font proc~grab->proc~world_matrix handle_point handle_point proc~grab->handle_point proc~grab->proc~constrained proc~ray_sphere ray_sphere proc~grab->proc~ray_sphere show_state show_state proc~grab->show_state proc~select_view WindowProxy%select_view proc~next_view->proc~select_view proc~previous_view->proc~select_view proc~release->show_state proc~replace_child->interface~vkf_node_add_child proc~replace_child->interface~vkf_node_delete proc~replace_child->proc~check_status interface~vkf_compile_node vkf_compile_node proc~replace_child->interface~vkf_compile_node interface~vkf_node_remove_child vkf_node_remove_child proc~replace_child->interface~vkf_node_remove_child proc~set_hovered->show_state proc~window_pick->proc~fm_frame proc~window_pick->proc~local_matrix proc~window_pick->proc~identity_matrix proc~child ReferenceFrame%child proc~window_pick->proc~child proc~num_children ReferenceFrame%num_children proc~window_pick->proc~num_children proc~pick ReferenceFrame%pick proc~window_pick->proc~pick proc~pickable ReferenceFrame%pickable proc~window_pick->proc~pickable proc~window_pick->proc~view_camera proc~world_matrix->proc~local_matrix proc~world_matrix->proc~world_matrix proc~arrow->proc~cross proc~constrained->proc~ray_sphere proc~ray_line ray_line proc~constrained->proc~ray_line proc~ray_plane ray_plane proc~constrained->proc~ray_plane proc~find_in_dirs find_in_dirs proc~find_font->proc~find_in_dirs interface~vkf_mesh_array vkf_mesh_array proc~mesh_arrays->interface~vkf_mesh_array proc~add_pick_hit add_pick_hit proc~pick->proc~add_pick_hit proc~point_pick point_pick proc~pick->proc~point_pick proc~wants wants proc~pick->proc~wants proc~view_camera->proc~is_open proc~view_camera->proc~aspect_ratio proc~view_camera->proc~field_of_view proc~view_camera->proc~orthographic_bounds proc~view_camera->proc~projection_type proc~view_camera->interface~vkf_viewer_size interface~vkf_viewer_pixel_ratio vkf_viewer_pixel_ratio proc~view_camera->interface~vkf_viewer_pixel_ratio proc~get_camera WindowProxy%get_camera proc~view_camera->proc~get_camera proc~pick_camera pick_camera proc~view_camera->proc~pick_camera proc~get_camera->proc~is_open proc~get_camera->interface~vkf_viewer_get_look_at proc~get_camera->proc~world_to_view proc~get_camera->proc~rigid_inverse proc~get_camera->proc~transform_camera proc~pick_camera->proc~cross proc~project project proc~point_pick->proc~project

Source Code

    subroutine resize(self, width, height, pixel_ratio)
        class(WindowProxy), intent(inout) :: self
        integer, intent(in) :: width, height                !! framebuffer pixels
        real(wp), intent(in), optional :: pixel_ratio       !! framebuffer pixels per window unit
        if (.not. c_associated(self%viewer_)) return
        if (present(pixel_ratio)) then
            if (pixel_ratio > 0.0_wp .and. pixel_ratio /= self%pixel_ratio_) then
                self%pixel_ratio_ = pixel_ratio
                if (vkf_viewer_set_pixel_ratio(self%viewer_, real(pixel_ratio, c_double)) /= 0) &
                    write(*, '(a)') 'vkframes: could not set the pixel ratio'
            end if
        end if
        self%width_ = max(1, width)
        self%height_ = max(1, height)
        if (vkf_viewer_resize(self%viewer_, int(width, c_int), int(height, c_int)) /= 0) &
            write(*, '(a)') 'vkframes: resize failed'
        ! a frame of the new size at once (once the scene is shown), so the window
        ! isn't shown stretched or blank while being resized
        if (self%scene_added) then
            if (self%frame()) continue
        end if
    end subroutine resize