summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2024-02-05 17:15:56 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2024-02-05 17:15:56 +1300
commit3eab055f80aeefc4db7564889a7c6fe172883422 (patch)
tree6e125cdf0b56309471eed05c0a5cc80c68d46b78 /src
parent74336ca78b2b6bd42b50cce21bd1fe71f98cc56a (diff)
Fl_Gl_Window bound
Diffstat (limited to 'src')
-rw-r--r--src/c_fl_gl_window.cpp182
-rw-r--r--src/c_fl_gl_window.h63
-rw-r--r--src/fltk-widgets-groups-windows-opengl.adb538
-rw-r--r--src/fltk-widgets-groups-windows-opengl.ads230
4 files changed, 1013 insertions, 0 deletions
diff --git a/src/c_fl_gl_window.cpp b/src/c_fl_gl_window.cpp
new file mode 100644
index 0000000..16af87d
--- /dev/null
+++ b/src/c_fl_gl_window.cpp
@@ -0,0 +1,182 @@
+
+
+#include <FL/Fl_Gl_Window.H>
+#include "c_fl_gl_window.h"
+#include "c_fl_type.h"
+
+
+
+
+class My_Gl_Window : public Fl_Gl_Window {
+ public:
+ using Fl_Gl_Window::Fl_Gl_Window;
+ friend void gl_window_set_draw_hook(GLWINDOW n, void * d);
+ friend void fl_gl_window_draw(GLWINDOW n);
+ friend void gl_window_set_handle_hook(GLWINDOW n, void * h);
+ friend int fl_gl_window_handle(GLWINDOW n, int e);
+ protected:
+ void draw();
+ void real_draw();
+ int handle(int e);
+ int real_handle(int e);
+ d_hook_p draw_hook;
+ h_hook_p handle_hook;
+};
+
+void My_Gl_Window::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+void My_Gl_Window::real_draw() {
+ Fl_Gl_Window::draw();
+}
+
+int My_Gl_Window::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+int My_Gl_Window::real_handle(int e) {
+ return Fl_Gl_Window::handle(e);
+}
+
+void gl_window_set_draw_hook(GLWINDOW n, void * d) {
+ reinterpret_cast<My_Gl_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d);
+}
+
+void fl_gl_window_draw(GLWINDOW n) {
+ reinterpret_cast<My_Gl_Window*>(n)->real_draw();
+}
+
+void gl_window_set_handle_hook(GLWINDOW n, void * h) {
+ reinterpret_cast<My_Gl_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+int fl_gl_window_handle(GLWINDOW n, int e) {
+ return reinterpret_cast<My_Gl_Window*>(n)->real_handle(e);
+}
+
+
+
+
+GLWINDOW new_fl_gl_window(int x, int y, int w, int h, char* label) {
+ My_Gl_Window *gw = new My_Gl_Window(x, y, w, h, label);
+ return gw;
+}
+
+GLWINDOW new_fl_gl_window2(int w, int h, char* label) {
+ My_Gl_Window *gw = new My_Gl_Window(w, h, label);
+ return gw;
+}
+
+void free_fl_gl_window(GLWINDOW w) {
+ delete reinterpret_cast<My_Gl_Window*>(w);
+}
+
+
+
+
+void fl_gl_window_show(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->show();
+}
+
+void fl_gl_window_hide(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->hide();
+}
+
+void fl_gl_window_hide_overlay(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->hide_overlay();
+}
+
+void fl_gl_window_flush(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->flush();
+}
+
+
+
+
+int fl_gl_window_pixel_h(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->pixel_h();
+}
+
+int fl_gl_window_pixel_w(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->pixel_w();
+}
+
+float fl_gl_window_pixels_per_unit(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->pixels_per_unit();
+}
+
+
+
+
+int fl_gl_window_get_mode(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->mode();
+}
+
+void fl_gl_window_set_mode(GLWINDOW w, int a) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->mode(a);
+}
+
+int fl_gl_window_static_can_do(int m) {
+ return Fl_Gl_Window::can_do(m);
+}
+
+int fl_gl_window_can_do(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->can_do();
+}
+
+int fl_gl_window_can_do_overlay(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->can_do_overlay();
+}
+
+
+
+
+void * fl_gl_window_get_context(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->context();
+}
+
+void fl_gl_window_set_context(GLWINDOW w, void * con, int des) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->context(con, des);
+}
+
+char fl_gl_window_context_valid(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->context_valid();
+}
+
+void fl_gl_window_set_context_valid(GLWINDOW w, char v) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->context_valid(v);
+}
+
+char fl_gl_window_valid(GLWINDOW w) {
+ return reinterpret_cast<Fl_Gl_Window*>(w)->valid();
+}
+
+void fl_gl_window_set_valid(GLWINDOW w, char v) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->valid(v);
+}
+
+void fl_gl_window_make_current(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->make_current();
+}
+
+void fl_gl_window_make_overlay_current(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->make_overlay_current();
+}
+
+
+
+
+void fl_gl_window_ortho(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->ortho();
+}
+
+void fl_gl_window_redraw_overlay(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->redraw_overlay();
+}
+
+void fl_gl_window_swap_buffers(GLWINDOW w) {
+ reinterpret_cast<Fl_Gl_Window*>(w)->swap_buffers();
+}
+
+
diff --git a/src/c_fl_gl_window.h b/src/c_fl_gl_window.h
new file mode 100644
index 0000000..134cb9c
--- /dev/null
+++ b/src/c_fl_gl_window.h
@@ -0,0 +1,63 @@
+
+
+#ifndef FL_GL_WINDOW_GUARD
+#define FL_GL_WINDOW_GUARD
+
+
+
+
+typedef void* GLWINDOW;
+
+
+
+
+extern "C" void gl_window_set_draw_hook(GLWINDOW n, void * d);
+extern "C" void fl_gl_window_draw(GLWINDOW n);
+extern "C" void gl_window_set_handle_hook(GLWINDOW n, void * h);
+extern "C" int fl_gl_window_handle(GLWINDOW n, int e);
+
+
+
+
+extern "C" GLWINDOW new_fl_gl_window(int x, int y, int w, int h, char* label);
+extern "C" GLWINDOW new_fl_gl_window2(int w, int h, char* label);
+extern "C" void free_fl_gl_window(GLWINDOW w);
+
+
+
+
+extern "C" void fl_gl_window_show(GLWINDOW w);
+extern "C" void fl_gl_window_hide(GLWINDOW w);
+extern "C" void fl_gl_window_hide_overlay(GLWINDOW w);
+extern "C" void fl_gl_window_flush(GLWINDOW w);
+
+
+extern "C" int fl_gl_window_pixel_h(GLWINDOW w);
+extern "C" int fl_gl_window_pixel_w(GLWINDOW w);
+extern "C" float fl_gl_window_pixels_per_unit(GLWINDOW w);
+
+
+extern "C" int fl_gl_window_get_mode(GLWINDOW w);
+extern "C" void fl_gl_window_set_mode(GLWINDOW w, int a);
+extern "C" int fl_gl_window_static_can_do(int m);
+extern "C" int fl_gl_window_can_do(GLWINDOW w);
+extern "C" int fl_gl_window_can_do_overlay(GLWINDOW w);
+
+
+extern "C" void * fl_gl_window_get_context(GLWINDOW w);
+extern "C" void fl_gl_window_set_context(GLWINDOW w, void * con, int des);
+extern "C" char fl_gl_window_context_valid(GLWINDOW w);
+extern "C" void fl_gl_window_set_context_valid(GLWINDOW w, char v);
+extern "C" char fl_gl_window_valid(GLWINDOW w);
+extern "C" void fl_gl_window_set_valid(GLWINDOW w, char v);
+extern "C" void fl_gl_window_make_current(GLWINDOW w);
+extern "C" void fl_gl_window_make_overlay_current(GLWINDOW w);
+
+
+extern "C" void fl_gl_window_ortho(GLWINDOW w);
+extern "C" void fl_gl_window_redraw_overlay(GLWINDOW w);
+extern "C" void fl_gl_window_swap_buffers(GLWINDOW w);
+
+
+#endif
+
diff --git a/src/fltk-widgets-groups-windows-opengl.adb b/src/fltk-widgets-groups-windows-opengl.adb
new file mode 100644
index 0000000..2d0ff45
--- /dev/null
+++ b/src/fltk-widgets-groups-windows-opengl.adb
@@ -0,0 +1,538 @@
+
+
+with
+
+ Interfaces.C,
+ System;
+
+use type
+
+ Interfaces.C.int,
+ Interfaces.C.signed_char,
+ Interfaces.C.unsigned,
+ System.Address;
+
+
+package body FLTK.Widgets.Groups.Windows.OpenGL is
+
+
+ procedure gl_window_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, gl_window_set_draw_hook, "gl_window_set_draw_hook");
+ pragma Inline (gl_window_set_draw_hook);
+
+ procedure gl_window_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, gl_window_set_handle_hook, "gl_window_set_handle_hook");
+ pragma Inline (gl_window_set_handle_hook);
+
+
+
+
+ function new_fl_gl_window
+ (X, Y, W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, new_fl_gl_window, "new_fl_gl_window");
+ pragma Inline (new_fl_gl_window);
+
+ function new_fl_gl_window2
+ (W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, new_fl_gl_window2, "new_fl_gl_window2");
+ pragma Inline (new_fl_gl_window2);
+
+ procedure free_fl_gl_window
+ (S : in System.Address);
+ pragma Import (C, free_fl_gl_window, "free_fl_gl_window");
+ pragma Inline (free_fl_gl_window);
+
+
+
+
+ procedure fl_gl_window_show
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_show, "fl_gl_window_show");
+ pragma Inline (fl_gl_window_show);
+
+ procedure fl_gl_window_hide
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_hide, "fl_gl_window_hide");
+ pragma Inline (fl_gl_window_hide);
+
+ procedure fl_gl_window_hide_overlay
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_hide_overlay, "fl_gl_window_hide_overlay");
+ pragma Inline (fl_gl_window_hide_overlay);
+
+ procedure fl_gl_window_flush
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_flush, "fl_gl_window_flush");
+ pragma Inline (fl_gl_window_flush);
+
+
+
+
+ function fl_gl_window_pixel_h
+ (S : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_pixel_h, "fl_gl_window_pixel_h");
+ pragma Inline (fl_gl_window_pixel_h);
+
+ function fl_gl_window_pixel_w
+ (S : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_pixel_w, "fl_gl_window_pixel_w");
+ pragma Inline (fl_gl_window_pixel_w);
+
+ function fl_gl_window_pixels_per_unit
+ (S : in System.Address)
+ return Interfaces.C.C_float;
+ pragma Import (C, fl_gl_window_pixels_per_unit, "fl_gl_window_pixels_per_unit");
+ pragma Inline (fl_gl_window_pixels_per_unit);
+
+
+
+
+ function fl_gl_window_get_mode
+ (S : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_get_mode, "fl_gl_window_get_mode");
+ pragma Inline (fl_gl_window_get_mode);
+
+ procedure fl_gl_window_set_mode
+ (S : in System.Address;
+ M : in Interfaces.C.int);
+ pragma Import (C, fl_gl_window_set_mode, "fl_gl_window_set_mode");
+ pragma Inline (fl_gl_window_set_mode);
+
+ function fl_gl_window_static_can_do
+ (M : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_static_can_do, "fl_gl_window_static_can_do");
+ pragma Inline (fl_gl_window_static_can_do);
+
+ function fl_gl_window_can_do
+ (S : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_can_do, "fl_gl_window_can_do");
+ pragma Inline (fl_gl_window_can_do);
+
+ function fl_gl_window_can_do_overlay
+ (S : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_can_do_overlay, "fl_gl_window_can_do_overlay");
+ pragma Inline (fl_gl_window_can_do_overlay);
+
+
+
+
+ function fl_gl_window_get_context
+ (S : in System.Address)
+ return System.Address;
+ pragma Import (C, fl_gl_window_get_context, "fl_gl_window_get_context");
+ pragma Inline (fl_gl_window_get_context);
+
+ procedure fl_gl_window_set_context
+ (S, P : in System.Address;
+ D : in Interfaces.C.int);
+ pragma Import (C, fl_gl_window_set_context, "fl_gl_window_set_context");
+ pragma Inline (fl_gl_window_set_context);
+
+ function fl_gl_window_context_valid
+ (S : in System.Address)
+ return Interfaces.C.signed_char;
+ pragma Import (C, fl_gl_window_context_valid, "fl_gl_window_context_valid");
+ pragma Inline (fl_gl_window_context_valid);
+
+ procedure fl_gl_window_set_context_valid
+ (S : in System.Address;
+ V : in Interfaces.C.signed_char);
+ pragma Import (C, fl_gl_window_set_context_valid, "fl_gl_window_set_context_valid");
+ pragma Inline (fl_gl_window_set_context_valid);
+
+ function fl_gl_window_valid
+ (S : in System.Address)
+ return Interfaces.C.signed_char;
+ pragma Import (C, fl_gl_window_valid, "fl_gl_window_valid");
+ pragma Inline (fl_gl_window_valid);
+
+ procedure fl_gl_window_set_valid
+ (S : in System.Address;
+ V : in Interfaces.C.signed_char);
+ pragma Import (C, fl_gl_window_set_valid, "fl_gl_window_set_valid");
+ pragma Inline (fl_gl_window_set_valid);
+
+ procedure fl_gl_window_make_current
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_make_current, "fl_gl_window_make_current");
+ pragma Inline (fl_gl_window_make_current);
+
+ procedure fl_gl_window_make_overlay_current
+ (S : in System.Address);
+ pragma Import (C, fl_gl_window_make_overlay_current, "fl_gl_window_make_overlay_current");
+ pragma Inline (fl_gl_window_make_overlay_current);
+
+
+
+
+ procedure fl_gl_window_ortho
+ (W : in System.Address);
+ pragma Import (C, fl_gl_window_ortho, "fl_gl_window_ortho");
+ pragma Inline (fl_gl_window_ortho);
+
+ procedure fl_gl_window_redraw_overlay
+ (W : in System.Address);
+ pragma Import (C, fl_gl_window_redraw_overlay, "fl_gl_window_redraw_overlay");
+ pragma Inline (fl_gl_window_redraw_overlay);
+
+ procedure fl_gl_window_swap_buffers
+ (W : in System.Address);
+ pragma Import (C, fl_gl_window_swap_buffers, "fl_gl_window_swap_buffers");
+ pragma Inline (fl_gl_window_swap_buffers);
+
+ procedure fl_gl_window_draw
+ (W : in System.Address);
+ pragma Import (C, fl_gl_window_draw, "fl_gl_window_draw");
+ pragma Inline (fl_gl_window_draw);
+
+ function fl_gl_window_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_gl_window_handle, "fl_gl_window_handle");
+ pragma Inline (fl_gl_window_handle);
+
+
+
+
+ procedure Finalize
+ (This : in out GL_Window) is
+ begin
+ if This.Void_Ptr /= System.Null_Address and then
+ This in GL_Window'Class
+ then
+ This.Clear;
+ free_fl_gl_window (This.Void_Ptr);
+ This.Void_Ptr := System.Null_Address;
+ end if;
+ Finalize (Window (This));
+ end Finalize;
+
+
+
+
+ --------------------
+ -- Constructors --
+ --------------------
+
+ package body Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String := "")
+ return GL_Window is
+ begin
+ return This : GL_Window do
+ This.Void_Ptr := new_fl_gl_window
+ (Interfaces.C.int (X),
+ Interfaces.C.int (Y),
+ Interfaces.C.int (W),
+ Interfaces.C.int (H),
+ Interfaces.C.To_C (Text));
+ fl_group_end (This.Void_Ptr);
+ fl_widget_set_user_data
+ (This.Void_Ptr,
+ Widget_Convert.To_Address (This'Unchecked_Access));
+ gl_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ gl_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
+ fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text));
+ end return;
+ end Create;
+
+
+ function Create
+ (W, H : in Integer;
+ Text : in String := "")
+ return GL_Window is
+ begin
+ return This : GL_Window do
+ This.Void_Ptr := new_fl_gl_window2
+ (Interfaces.C.int (W),
+ Interfaces.C.int (H),
+ Interfaces.C.To_C (Text));
+ fl_group_end (This.Void_Ptr);
+ fl_widget_set_user_data
+ (This.Void_Ptr,
+ Widget_Convert.To_Address (This'Unchecked_Access));
+ gl_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ gl_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
+ fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text));
+ end return;
+ end Create;
+
+ end Forge;
+
+
+
+
+ ---------------
+ -- Display --
+ ---------------
+
+ procedure Show
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_show (This.Void_Ptr);
+ end Show;
+
+
+ procedure Hide
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_hide (This.Void_Ptr);
+ end Hide;
+
+
+ procedure Hide_Overlay
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_hide_overlay (This.Void_Ptr);
+ end Hide_Overlay;
+
+
+ procedure Flush
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_flush (This.Void_Ptr);
+ end Flush;
+
+
+
+
+ ------------------
+ -- Dimensions --
+ ------------------
+
+ function Pixel_H
+ (This : in GL_Window)
+ return Integer is
+ begin
+ return Integer (fl_gl_window_pixel_h (This.Void_Ptr));
+ end Pixel_H;
+
+
+ function Pixel_W
+ (This : in GL_Window)
+ return Integer is
+ begin
+ return Integer (fl_gl_window_pixel_w (This.Void_Ptr));
+ end Pixel_W;
+
+
+ function Pixels_Per_Unit
+ (This : in GL_Window)
+ return Float is
+ begin
+ return Float (fl_gl_window_pixels_per_unit (This.Void_Ptr));
+ end Pixels_Per_Unit;
+
+
+
+
+ --------------------
+ -- OpenGL Modes --
+ --------------------
+
+ function Get_Mode
+ (This : in GL_Window)
+ return Mode_Mask
+ is
+ Raw : Interfaces.C.unsigned := Interfaces.C.unsigned
+ (fl_gl_window_get_mode (This.Void_Ptr));
+ begin
+ return
+ (Index => (Raw and 1) /= 0,
+ Double => (Raw and 2) /= 0,
+ Accum => (Raw and 4) /= 0,
+ Alpha => (Raw and 8) /= 0,
+ Depth => (Raw and 16) /= 0,
+ Stencil => (Raw and 32) /= 0,
+ RGB8 => (Raw and 64) /= 0,
+ Multisample => (Raw and 128) /= 0,
+ Stereo => (Raw and 256) /= 0,
+ Fake_Single => (Raw and 512) /= 0,
+ OpenGL3 => (Raw and 1024) /= 0);
+ end Get_Mode;
+
+
+ procedure Set_Mode
+ (This : in out GL_Window;
+ Mask : in Mode_Mask) is
+ begin
+ fl_gl_window_set_mode (This.Void_Ptr,
+ Boolean'Pos (Mask.Index) * 1 +
+ Boolean'Pos (Mask.Double) * 2 +
+ Boolean'Pos (Mask.Accum) * 4 +
+ Boolean'Pos (Mask.Alpha) * 8 +
+ Boolean'Pos (Mask.Depth) * 16 +
+ Boolean'Pos (Mask.Stencil) * 32 +
+ Boolean'Pos (Mask.RGB8) * 64 +
+ Boolean'Pos (Mask.Multisample) * 128 +
+ Boolean'Pos (Mask.Stereo) * 256 +
+ Boolean'Pos (Mask.Fake_Single) * 512 +
+ Boolean'Pos (Mask.OpenGL3) * 1024);
+ end Set_Mode;
+
+
+ function Can_Do
+ (Mask : in Mode_Mask)
+ return Boolean is
+ begin
+ return fl_gl_window_static_can_do
+ (Boolean'Pos (Mask.Index) * 1 +
+ Boolean'Pos (Mask.Double) * 2 +
+ Boolean'Pos (Mask.Accum) * 4 +
+ Boolean'Pos (Mask.Alpha) * 8 +
+ Boolean'Pos (Mask.Depth) * 16 +
+ Boolean'Pos (Mask.Stencil) * 32 +
+ Boolean'Pos (Mask.RGB8) * 64 +
+ Boolean'Pos (Mask.Multisample) * 128 +
+ Boolean'Pos (Mask.Stereo) * 256 +
+ Boolean'Pos (Mask.Fake_Single) * 512 +
+ Boolean'Pos (Mask.OpenGL3) * 1024) /= 0;
+ end Can_Do;
+
+
+ function Can_Do
+ (This : in GL_Window)
+ return Boolean is
+ begin
+ return fl_gl_window_can_do (This.Void_Ptr) /= 0;
+ end Can_Do;
+
+
+ function Can_Do_Overlay
+ (This : in GL_Window)
+ return Boolean is
+ begin
+ return fl_gl_window_can_do_overlay (This.Void_Ptr) /= 0;
+ end Can_Do_Overlay;
+
+
+
+
+ -----------------------
+ -- OpenGL Contexts --
+ -----------------------
+
+ function Get_Context
+ (This : in GL_Window)
+ return System.Address is
+ begin
+ return fl_gl_window_get_context (This.Void_Ptr);
+ end Get_Context;
+
+
+ procedure Set_Context
+ (This : in out GL_Window;
+ Struct : in System.Address;
+ Destroy : in Boolean := False) is
+ begin
+ fl_gl_window_set_context (This.Void_Ptr, Struct, Boolean'Pos (Destroy));
+ end Set_Context;
+
+
+ function Get_Context_Valid
+ (This : in GL_Window)
+ return Boolean is
+ begin
+ return fl_gl_window_context_valid (This.Void_Ptr) /= 0;
+ end Get_Context_Valid;
+
+
+ procedure Set_Context_Valid
+ (This : in out GL_Window;
+ Value : in Boolean) is
+ begin
+ fl_gl_window_set_context_valid (This.Void_Ptr, Boolean'Pos (Value));
+ end Set_Context_Valid;
+
+
+ function Get_Valid
+ (This : in GL_Window)
+ return Boolean is
+ begin
+ return fl_gl_window_valid (This.Void_Ptr) /= 0;
+ end Get_Valid;
+
+
+ procedure Set_Valid
+ (This : in out GL_Window;
+ Value : in Boolean) is
+ begin
+ fl_gl_window_set_valid (This.Void_Ptr, Boolean'Pos (Value));
+ end Set_Valid;
+
+
+ procedure Make_Current
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_make_current (This.Void_Ptr);
+ end Make_Current;
+
+
+ procedure Make_Overlay_Current
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_make_overlay_current (This.Void_Ptr);
+ end Make_Overlay_Current;
+
+
+
+
+ ----------------------------------
+ -- Drawing and Event Handling --
+ ----------------------------------
+
+ procedure Ortho
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_ortho (This.Void_Ptr);
+ end Ortho;
+
+
+ procedure Redraw_Overlay
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_redraw_overlay (This.Void_Ptr);
+ end Redraw_Overlay;
+
+
+ procedure Swap_Buffers
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_swap_buffers (This.Void_Ptr);
+ end Swap_Buffers;
+
+
+ procedure Draw
+ (This : in out GL_Window) is
+ begin
+ fl_gl_window_draw (This.Void_Ptr);
+ end Draw;
+
+
+ function Handle
+ (This : in out GL_Window;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_gl_window_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+end FLTK.Widgets.Groups.Windows.OpenGL;
+
diff --git a/src/fltk-widgets-groups-windows-opengl.ads b/src/fltk-widgets-groups-windows-opengl.ads
new file mode 100644
index 0000000..81d01c4
--- /dev/null
+++ b/src/fltk-widgets-groups-windows-opengl.ads
@@ -0,0 +1,230 @@
+
+
+with
+
+ System;
+
+private with
+
+ Interfaces.C;
+
+
+package FLTK.Widgets.Groups.Windows.OpenGL is
+
+
+ -------------
+ -- Types --
+ -------------
+
+ type GL_Window is new Window with private;
+
+ type GL_Window_Reference (Data : not null access GL_Window'Class) is
+ limited null record with Implicit_Dereference => Data;
+
+ type Mode_Mask is record
+ Index : Boolean;
+ Double : Boolean;
+ Accum : Boolean;
+ Alpha : Boolean;
+ Depth : Boolean;
+ Stencil : Boolean;
+ RGB8 : Boolean;
+ Multisample : Boolean;
+ Stereo : Boolean;
+ Fake_Single : Boolean;
+ OpenGL3 : Boolean;
+ end record;
+
+
+
+
+ --------------------
+ -- Constructors --
+ --------------------
+
+ package Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String := "")
+ return GL_Window;
+
+ function Create
+ (W, H : in Integer;
+ Text : in String := "")
+ return GL_Window;
+
+ end Forge;
+
+
+
+
+ ---------------
+ -- Display --
+ ---------------
+
+ procedure Show
+ (This : in out GL_Window);
+
+ procedure Hide
+ (This : in out GL_Window);
+
+ procedure Hide_Overlay
+ (This : in out GL_Window);
+
+ procedure Flush
+ (This : in out GL_Window);
+
+
+
+
+ ------------------
+ -- Dimensions --
+ ------------------
+
+ function Pixel_H
+ (This : in GL_Window)
+ return Integer;
+
+ function Pixel_W
+ (This : in GL_Window)
+ return Integer;
+
+ function Pixels_Per_Unit
+ (This : in GL_Window)
+ return Float;
+
+
+
+
+ --------------------
+ -- OpenGL Modes --
+ --------------------
+
+ function Get_Mode
+ (This : in GL_Window)
+ return Mode_Mask;
+
+ procedure Set_Mode
+ (This : in out GL_Window;
+ Mask : in Mode_Mask);
+
+ function Can_Do
+ (Mask : in Mode_Mask)
+ return Boolean;
+
+ function Can_Do
+ (This : in GL_Window)
+ return Boolean;
+
+ function Can_Do_Overlay
+ (This : in GL_Window)
+ return Boolean;
+
+
+
+
+ -----------------------
+ -- OpenGL Contexts --
+ -----------------------
+
+ function Get_Context
+ (This : in GL_Window)
+ return System.Address;
+
+ procedure Set_Context
+ (This : in out GL_Window;
+ Struct : in System.Address;
+ Destroy : in Boolean := False);
+
+ function Get_Context_Valid
+ (This : in GL_Window)
+ return Boolean;
+
+ procedure Set_Context_Valid
+ (This : in out GL_Window;
+ Value : in Boolean);
+
+ function Get_Valid
+ (This : in GL_Window)
+ return Boolean;
+
+ procedure Set_Valid
+ (This : in out GL_Window;
+ Value : in Boolean);
+
+ procedure Make_Current
+ (This : in out GL_Window);
+
+ procedure Make_Overlay_Current
+ (This : in out GL_Window);
+
+
+
+
+ ----------------------------------
+ -- Drawing and Event Handling --
+ ----------------------------------
+
+ procedure Ortho
+ (This : in out GL_Window);
+
+ procedure Redraw_Overlay
+ (This : in out GL_Window);
+
+ procedure Swap_Buffers
+ (This : in out GL_Window);
+
+ procedure Draw
+ (This : in out GL_Window);
+
+ function Handle
+ (This : in out GL_Window;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
+private
+
+
+ type GL_Window is new Window with null record;
+
+ overriding procedure Finalize
+ (This : in out GL_Window);
+
+
+
+
+ pragma Inline (Show);
+ pragma Inline (Hide);
+ pragma Inline (Hide_Overlay);
+ pragma Inline (Flush);
+
+
+ pragma Inline (Pixel_H);
+ pragma Inline (Pixel_W);
+ pragma Inline (Pixels_Per_Unit);
+
+
+ pragma Inline (Can_Do_Overlay);
+
+
+ pragma Inline (Get_Context);
+ pragma Inline (Set_Context);
+ pragma Inline (Get_Context_Valid);
+ pragma Inline (Set_Context_Valid);
+ pragma Inline (Get_Valid);
+ pragma Inline (Set_Valid);
+ pragma Inline (Make_Current);
+ pragma Inline (Make_Overlay_Current);
+
+
+ pragma Inline (Ortho);
+ pragma Inline (Redraw_Overlay);
+ pragma Inline (Swap_Buffers);
+ pragma Inline (Draw);
+ pragma Inline (Handle);
+
+
+end FLTK.Widgets.Groups.Windows.OpenGL;
+