1
1

init.d 865 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module three.init;
  2. import derelict.opengl3.gl3;
  3. import derelict.glfw3.glfw3;
  4. //import derelict.freetype.ft;
  5. import derelict.anttweakbar.anttweakbar;
  6. import three.glfw.window;
  7. import std.stdio;
  8. import std.conv;
  9. import std.typecons;
  10. Unique!(Window) initThree() {
  11. DerelictGL3.load();
  12. DerelictGLFW3.load();
  13. //DerelictFT.load();
  14. //~ if(!freeTypeInit()) throw new Exception("FreeType init failed");
  15. if(!glfwInit()) throw new Exception("GLFW init failed");
  16. Unique!(Window) window = new Window("Fray", 1024, 768);
  17. try {
  18. GLVersion glVersion = DerelictGL3.reload();
  19. writeln("Loaded OpenGL Version", to!string(glVersion));
  20. } catch(Exception e) {
  21. writeln("exception: "~ e.msg);
  22. }
  23. DerelictAntTweakBar.load();
  24. TwInit(TW_OPENGL_CORE, null);
  25. return window.release();
  26. }
  27. void deinitThree() {
  28. glfwTerminate();
  29. TwTerminate();
  30. //freeTypeDeinit();
  31. }