X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=util.cpp;h=579efb35409d4a17ddc22838ce3dbcec4c82fc92;hb=95edbfccb0843da3cc105dadc5bc6d8e102f6071;hp=cce3d54a09492956b828cd65c092d15650fab033;hpb=926348692a4138e9c88f49ef43657dedb5f36897;p=movit diff --git a/util.cpp b/util.cpp index cce3d54..579efb3 100644 --- a/util.cpp +++ b/util.cpp @@ -9,7 +9,7 @@ #include "init.h" #include "util.h" -#if defined(__DARWIN__) +#if defined(__APPLE__) #include #elif defined(WIN32) #include @@ -96,6 +96,19 @@ string read_file(const string &filename) return string(buf, len); } +string read_version_dependent_file(const string &base, const string &extension) +{ + if (movit_shader_model == MOVIT_GLSL_110) { + return read_file(base + "." + extension); + } else if (movit_shader_model == MOVIT_GLSL_130) { + return read_file(base + ".130." + extension); + } else if (movit_shader_model == MOVIT_ESSL_300) { + return read_file(base + ".300es." + extension); + } else { + assert(false); + } +} + GLuint compile_shader(const string &shader_src, GLenum type) { GLuint obj = glCreateShader(type); @@ -243,7 +256,7 @@ unsigned next_power_of_two(unsigned v) void *get_gl_context_identifier() { -#if defined(__DARWIN__) +#if defined(__APPLE__) return (void *)CGLGetCurrentContext(); #elif defined(WIN32) return (void *)wglGetCurrentContext();