pull in DerelictGL3 and load it

This commit is contained in:
josh committed 2020-08-03 16:53:22 -04:00
1 parent 56c20c4a36
commit 3f4a8709b5
7 files changed
+26 -2

No files matched your search

+9
View File
@@ -4,3 +4,12 @@
[submodule "libs/glcxx"] [submodule "libs/glcxx"]
path = libs/glcxx path = libs/glcxx
url = git://github.com/holtrop/glcxx.git 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
+2 -2
View File
@@ -6,9 +6,9 @@ end
build do build do
main_env = Rscons::Environment.new do |env| 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["CCFLAGS"] += %w[-Wall]
env["D_IMPORT_PATH"] += glob("src/**") env["D_IMPORT_PATH"] += glob("src/**", "libs/Derelict*/source")
env["DFLAGS"] += %w[-Wall] env["DFLAGS"] += %w[-Wall]
env["LIBS"] += %w[X11 GLX] env["LIBS"] += %w[X11 GLX]
env.Program("jes", "${sources}") env.Program("jes", "${sources}")
+1
Submodule libs/DerelictGL3 added at e1197a6c5f.
Submodule libs/DerelictGLFW3 added at 09b9680cc8.
+1
Submodule libs/DerelictUtil added at 8dda33953e.
+4
View File
@@ -4,11 +4,15 @@ static import jtk.event;
static import jtk.timer; static import jtk.timer;
static import jtk.window; static import jtk.window;
import derelict.opengl;
private extern(C) bool jtk_init(); private extern(C) bool jtk_init();
private extern(C) void jtk_quit(); private extern(C) void jtk_quit();
bool init() bool init()
{ {
DerelictGL3.load();
if (!jtk_init()) if (!jtk_init())
{ {
return false; return false;
+8
View File
@@ -3,6 +3,8 @@ module jtk.window;
import std.string; import std.string;
import core.sync.mutex; import core.sync.mutex;
import derelict.opengl;
private extern(C) bool jtk_window_create(ulong * window); 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_swap_buffers(ulong window);
private extern(C) void jtk_window_close(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 Window[ulong] windows_by_id;
private static Mutex windows_by_id_mutex; private static Mutex windows_by_id_mutex;
private static bool derelict_reloaded;
private ulong m_window; private ulong m_window;
this() this()
@@ -22,6 +25,11 @@ class Window
{ {
/* TODO */ /* TODO */
} }
if (!derelict_reloaded)
{
DerelictGL3.reload();
derelict_reloaded = true;
}
synchronized(windows_by_id_mutex) synchronized(windows_by_id_mutex)
{ {
windows_by_id[m_window] = this; windows_by_id[m_window] = this;