#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include <algorithm>
+#include <string>
#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;
// Now generate a simple texture that's just [0,1].
GLuint src_texnum;
float texdata[] = { 0, 1 };
- glGenTextures(1, &dst_texnum);
+ glGenTextures(1, &src_texnum);
check_error();
- glBindTexture(GL_TEXTURE_1D, dst_texnum);
+ glBindTexture(GL_TEXTURE_1D, src_texnum);
check_error();
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
check_error();
} // 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