I am searching for a template program that I can use for programs using VtkADA
GNAT Studio provides project template for GtkAda application. You can use it as starting point.
Here is a post related to using Gtk with Vtk.
I have no idea if OpenGL is needed for Vtk rendering. If so, it is technically supported by Gtk and GtkAda but in practice never included because Gtk applications rather deploy Cairo. So you might need to download GtkAda sources and build them with OpenGL enabled.
Here is hello-world in GtkAda:
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Table; use Gtk.Table;
with Ada.Unchecked_Conversion;
with Gdk.Event;
with Gtk.Main;
procedure Hello is
Window : Gtk_Window;
Grid : Gtk_Table;
Label : Gtk_Label;
type Event_Callback is not null access function
( Self : access Gtk_Widget_Record'Class;
Event : Gdk.Event.Gdk_Event
) return Boolean;
function "+" is
new Ada.Unchecked_Conversion
( Event_Callback,
Cb_Gtk_Widget_Gdk_Event_Boolean
);
type Destroy_Callback is access procedure
( Widget : access Gtk_Widget_Record'Class
);
function "+" is
new Ada.Unchecked_Conversion
( Destroy_Callback,
Cb_Gtk_Widget_Void
);
function Delete_Event_Handler
( Widget : access Gtk_Widget_Record'Class;
Event : Gdk.Event.Gdk_Event
) return Boolean is
begin
return False;
end Delete_Event_Handler;
procedure Destroy_Handler
( Widget : access Gtk_Widget_Record'Class
) is
begin
Gtk.Main.Main_Quit;
end Destroy_Handler;
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window);
Window.Set_Title ("Hello World");
Window.On_Delete_Event (+Delete_Event_Handler'Access);
Window.On_Destroy (+Destroy_Handler'Access);
Gtk_New (Grid, 1, 1, False);
Window.Add (Grid);
Gtk_New (Label);
Label.Set_Text ("Hello World!");
Grid.Attach (Label, 0, 1, 0, 1);
Label.Show;
Grid.Show;
Window.Show;
Gtk.Main.Main;
end Hello;