text
stringlengths
0
234
-- update camera frustum
--
MatrixMode (MODELVIEW);
Set_GL_Matrix (Self.all.Camera.World_Rotation);
Translate (-Self.all.Camera.Clipper.Eye_Position (0), -Self.all.Camera.Clipper.Eye_Position (1), -Self.all.Camera.Clipper.Eye_Position (2));
Self.all.Camera.frustum_Planes := GL.Frustums.Current_Planes; -- tbd : getting frustum planes from camera, might be quicker,
-- set_frustum_Planes (Self.Camera); -- but 'set_frustum_Planes' seems buggy :/.
-- video management
--
if Self.all.game_command (video) then
if Self.all.is_capturing_Video then
GL.IO.Stop_Capture;
Self.all.is_capturing_Video := False;
else
GL.IO.Start_Capture (AVI_Name => To_String (Self.all.Name) & "." & Image (Ada.Calendar.Clock) & ".avi",
frame_rate => 8); -- Integer (self.Frames_per_second));
Self.all.is_capturing_Video := True;
end if;
end if;
if Self.all.is_capturing_Video then
GL.IO.Capture_Frame;
end if;
-- photo management
--
if Self.all.game_command (photo) then
GL.IO.Screenshot (Name => To_String (Self.all.Name) & "." & Image (Ada.Calendar.Clock) & ".bmp");
end if;
end Main_Operations;
procedure Close_Window is
begin
current_Window.all.is_Closed := True;
end Close_Window;
procedure Update_Visibility (State : Integer) is
begin
-- ada.text_io.put_line ("in update_Visibility callback state : " & integer'image (State));
--
-- tbd : this callback is not being called when a window is iconicised !!
current_Window.all.is_Visible := not (State = GLUT.HIDDEN or else State = GLUT.FULLY_COVERED);
end Update_Visibility;
procedure Start_GLUTs (Self : in out Window) is
use GLUT;
function to_Address is new Ada.Unchecked_Conversion (GLOBE_3D.p_Window, System.Address);
GLUT_options : GLUT.Unsigned := GLUT.DOUBLE or GLUT.RGBA or GLUT.ALPHA or GLUT.DEPTH;
begin
if Self.Smoothing = Hardware then
GLUT_options := GLUT_options or GLUT.MULTISAMPLE;
end if;
InitDisplayMode (GLUT_options);
set_Size (Self, 500, 400);
InitWindowSize (Integer (Self.main_size_x), Integer (Self.main_size_y));
InitWindowPosition (120, 120);
Self.glut_Window := CreateWindow ("GLOBE_3D/GLUT Window");
if Self.glut_Window = 0 then
raise GLUT_Problem;
end if;
GLUT.CloseFunc (Close_Window'Access);
GLUT.ReshapeFunc (Window_Resize'Access);
GLUT.WindowStatusFunc (Update_Visibility'Access);
GLUT.SetWindowData (to_Address (GLOBE_3D.Window'Class (Self)'Unchecked_Access));
GLUT.Devices.Initialize;
-- if CreateMenu (Menu'Access) = 0 then -- tdb : deferred
-- raise GLUT_Problem;
-- end if;
-- AttachMenu (MIDDLE_BUTTON);
-- AddMenuEntry (" * Full Screen", 1);
-- AddMenuEntry ("--> Exit (Esc)", 2);
end Start_GLUTs;
procedure Start_GLs (Self : in out Window) is
fog_colour : GL.Light_Float_vector := (0.2, 0.2, 0.2, 0.1);
begin