X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=init.cpp;h=195dccacc58ae05ee1d11bcb251a63cf08bf7d4e;hp=a89028c645eb1504a203b0562948a4693ebfa614;hb=37f56fcbe571b2322243f6de59494bf9e0cbb37a;hpb=29072985d0a00a53e5b578a1444cee61a0c9e1f2 diff --git a/init.cpp b/init.cpp index a89028c..195dcca 100644 --- a/init.cpp +++ b/init.cpp @@ -1,17 +1,27 @@ #include +#include +#include +#include +#include #include "init.h" #include "util.h" bool movit_initialized = false; +MovitDebugLevel movit_debug_level = MOVIT_DEBUG_ON; float movit_texel_subpixel_precision; bool movit_srgb_textures_supported; +// The rules for objects with nontrivial constructors in static scope +// are somewhat convoluted, and easy to mess up. We simply have a +// pointer instead (and never care to clean it up). +std::string *movit_data_directory = NULL; + namespace { void measure_texel_subpixel_precision() { - static const unsigned width = 1024; + static const unsigned width = 4096; // Generate a destination texture to render to, and an FBO. GLuint dst_texnum, fbo; @@ -148,12 +158,15 @@ void check_extensions() } // namespace -void init_movit() +void init_movit(const std::string& data_directory, MovitDebugLevel debug_level) { if (movit_initialized) { return; } + movit_data_directory = new std::string(data_directory); + movit_debug_level = debug_level; + glewInit(); // geez