From 3f4a8709b50d869619acc76f0ec039d9a5e4b253 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 3 Aug 2020 16:53:22 -0400 Subject: [PATCH] pull in DerelictGL3 and load it --- .gitmodules | 9 +++++++++ Rsconscript | 4 ++-- libs/DerelictGL3 | 1 + libs/DerelictGLFW3 | 1 + libs/DerelictUtil | 1 + src/jtk/init.d | 4 ++++ src/jtk/window.d | 8 ++++++++ 7 files changed, 26 insertions(+), 2 deletions(-) create mode 160000 libs/DerelictGL3 create mode 160000 libs/DerelictGLFW3 create mode 160000 libs/DerelictUtil diff --git a/.gitmodules b/.gitmodules index 8f66578..cefb9d4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,12 @@ [submodule "libs/glcxx"] path = libs/glcxx url = git://github.com/holtrop/glcxx.git +[submodule "libs/DerelictGL3"] + path = libs/DerelictGL3 + url = git://github.com/DerelictOrg/DerelictGL3 +[submodule "libs/DerelictGLFW3"] + path = libs/DerelictGLFW3 + url = git://github.com/DerelictOrg/DerelictGLFW3 +[submodule "libs/DerelictUtil"] + path = libs/DerelictUtil + url = git://github.com/DerelictOrg/DerelictUtil diff --git a/Rsconscript b/Rsconscript index 172b92b..afd9cf9 100644 --- a/Rsconscript +++ b/Rsconscript @@ -6,9 +6,9 @@ end build do main_env = Rscons::Environment.new do |env| - env["sources"] = glob("src/**/*.{c,d}") + env["sources"] = glob("src/**/*.{c,d}", "libs/Derelict*/**/*.d") env["CCFLAGS"] += %w[-Wall] - env["D_IMPORT_PATH"] += glob("src/**") + env["D_IMPORT_PATH"] += glob("src/**", "libs/Derelict*/source") env["DFLAGS"] += %w[-Wall] env["LIBS"] += %w[X11 GLX] env.Program("jes", "${sources}") diff --git a/libs/DerelictGL3 b/libs/DerelictGL3 new file mode 160000 index 0000000..e1197a6 --- /dev/null +++ b/libs/DerelictGL3 @@ -0,0 +1 @@ +Subproject commit e1197a6c5f644a8c4a2f132de03d5c979490690c diff --git a/libs/DerelictGLFW3 b/libs/DerelictGLFW3 new file mode 160000 index 0000000..09b9680 --- /dev/null +++ b/libs/DerelictGLFW3 @@ -0,0 +1 @@ +Subproject commit 09b9680cc8b40e20a48b2c008907cc749254aced diff --git a/libs/DerelictUtil b/libs/DerelictUtil new file mode 160000 index 0000000..8dda339 --- /dev/null +++ b/libs/DerelictUtil @@ -0,0 +1 @@ +Subproject commit 8dda33953e05e228a8a0459954023de2c0b375b5 diff --git a/src/jtk/init.d b/src/jtk/init.d index 965997b..59c2e34 100644 --- a/src/jtk/init.d +++ b/src/jtk/init.d @@ -4,11 +4,15 @@ static import jtk.event; static import jtk.timer; static import jtk.window; +import derelict.opengl; + private extern(C) bool jtk_init(); private extern(C) void jtk_quit(); bool init() { + DerelictGL3.load(); + if (!jtk_init()) { return false; diff --git a/src/jtk/window.d b/src/jtk/window.d index 710cb97..6a6dce4 100644 --- a/src/jtk/window.d +++ b/src/jtk/window.d @@ -3,6 +3,8 @@ module jtk.window; import std.string; import core.sync.mutex; +import derelict.opengl; + private extern(C) bool jtk_window_create(ulong * window); private extern(C) void jtk_window_swap_buffers(ulong window); private extern(C) void jtk_window_close(ulong window); @@ -14,6 +16,7 @@ class Window { private static Window[ulong] windows_by_id; private static Mutex windows_by_id_mutex; + private static bool derelict_reloaded; private ulong m_window; this() @@ -22,6 +25,11 @@ class Window { /* TODO */ } + if (!derelict_reloaded) + { + DerelictGL3.reload(); + derelict_reloaded = true; + } synchronized(windows_by_id_mutex) { windows_by_id[m_window] = this;