X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=init.cpp;h=a89028c645eb1504a203b0562948a4693ebfa614;hb=29072985d0a00a53e5b578a1444cee61a0c9e1f2;hp=ac52aa2ce3d7eee956e6cc629912e699bb6553b1;hpb=38fca90c6ffde05e3459c7021e823cef0b3b27ac;p=movit diff --git a/init.cpp b/init.cpp index ac52aa2..a89028c 100644 --- a/init.cpp +++ b/init.cpp @@ -1,10 +1,8 @@ +#include + #include "init.h" -#include "opengl.h" #include "util.h" -#include -#include - bool movit_initialized = false; float movit_texel_subpixel_precision; bool movit_srgb_textures_supported; @@ -123,41 +121,29 @@ void measure_texel_subpixel_precision() check_error(); } -void get_extensions(std::set *extensions) -{ - char *str = strdup(reinterpret_cast(glGetString(GL_EXTENSIONS))); - for (char *ptr = strtok(str, " "); ptr != NULL; ptr = strtok(NULL, " ")) { - extensions->insert(ptr); - } - free(str); -} - void check_extensions() { - std::set extensions; - get_extensions(&extensions); - // We fundamentally need FBOs and floating-point textures. - assert(extensions.count("GL_ARB_framebuffer_object") != 0); - assert(extensions.count("GL_ARB_texture_float") != 0); + assert(glewIsSupported("GL_ARB_framebuffer_object") != 0); + assert(glewIsSupported("GL_ARB_texture_float") != 0); // We assume that we can use non-power-of-two textures without restrictions. - assert(extensions.count("GL_ARB_texture_non_power_of_two") != 0); + assert(glewIsSupported("GL_ARB_texture_non_power_of_two") != 0); // We also need GLSL fragment shaders. - assert(extensions.count("GL_ARB_fragment_shader") != 0); - assert(extensions.count("GL_ARB_shading_language_100") != 0); + assert(glewIsSupported("GL_ARB_fragment_shader") != 0); + assert(glewIsSupported("GL_ARB_shading_language_100") != 0); // FlatInput and YCbCrInput uses PBOs. (They could in theory do without, // but no modern card would really not provide it.) - assert(extensions.count("GL_ARB_pixel_buffer_object") != 0); + assert(glewIsSupported("GL_ARB_pixel_buffer_object") != 0); // ResampleEffect uses RG textures to encode a two-component LUT. - assert(extensions.count("GL_ARB_texture_rg") != 0); + assert(glewIsSupported("GL_ARB_texture_rg") != 0); // sRGB texture decode would be nice, but are not mandatory // (GammaExpansionEffect can do the same thing if needed). - movit_srgb_textures_supported = extensions.count("GL_EXT_texture_sRGB"); + movit_srgb_textures_supported = glewIsSupported("GL_EXT_texture_sRGB"); } } // namespace @@ -168,6 +154,8 @@ void init_movit() return; } + glewInit(); + // geez glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);