1
1

init.d 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. module three.init;
  2. import derelict.opengl3.gl3;
  3. import derelict.glfw3.glfw3;
  4. import derelict.anttweakbar.anttweakbar;
  5. import derelict.freeimage.freeimage;
  6. import derelict.freetype.ft;
  7. import derelict.assimp3.assimp;
  8. import three.glfw.window;
  9. import std.stdio;
  10. import std.conv;
  11. private static FT_Library _s_freeTypeLibrary;
  12. Window initThree() {
  13. "Starting Three.d".writeln();
  14. "Loading OpenGL".writeln();
  15. DerelictGL3.load();
  16. "Loading GLFW".writeln();
  17. DerelictGLFW3.load();
  18. "Loading FreeImage".writeln();
  19. DerelictFI.load();
  20. // "Loading FreeType".writeln();
  21. // DerelictFT.load();
  22. "Loading Assimp".writeln();
  23. DerelictASSIMP3.load();
  24. "Loading AntTweakBar".writeln();
  25. DerelictAntTweakBar.load();
  26. "Initialising GLFW".writeln();
  27. if(!glfwInit()) throw new Exception("Initialising GLFW failed");
  28. "Creating Window".writeln();
  29. auto window = new Window("Fray", 1600, 900);
  30. "ReLoading OpenGL".writeln();
  31. try {
  32. GLVersion glVersion = DerelictGL3.reload();
  33. writeln("Loaded OpenGL Version", to!string(glVersion));
  34. } catch(Exception e) {
  35. writeln("exception: "~ e.msg);
  36. }
  37. // "Initialising FreeType".writeln();
  38. // if(!FT_Init_FreeType(&_s_freeTypeLibrary)) throw new Exception("Initialising FreeType failed");
  39. "Initialising AntTweakBar".writeln();
  40. if(TwInit(TW_OPENGL_CORE, null) == 0) throw new Exception("Initialising AntTweakBar failed");
  41. return window;
  42. }
  43. void deinitThree() {
  44. "Terminating AntTweakBar".writeln();
  45. TwTerminate();
  46. // "Terminating FreeType".writeln();
  47. // FT_Done_FreeType(_s_freeTypeLibrary);
  48. "Terminating GLFW".writeln();
  49. glfwTerminate();
  50. }