+ glTextureStorage2D(final_tex, 1, GL_RG16F, width, height);
+ resize_flow.exec(prev_level_flow_tex, final_tex, prev_level_width, prev_level_height, width, height);
+ return final_tex;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ static const option long_options[] = {
+ { "alpha", required_argument, 0, 'a' },
+ { "delta", required_argument, 0, 'd' },
+ { "gamma", required_argument, 0, 'g' }
+ };
+
+ for ( ;; ) {
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "a:d:g:", long_options, &option_index);
+
+ if (c == -1) {
+ break;
+ }
+ switch (c) {
+ case 'a':
+ vr_alpha = atof(optarg);
+ break;
+ case 'd':
+ vr_delta = atof(optarg);
+ break;
+ case 'g':
+ vr_gamma = atof(optarg);
+ break;
+ default:
+ fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
+ exit(1);
+ };
+ }
+
+ if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
+ fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
+ exit(1);
+ }
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
+ // SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
+ SDL_Window *window = SDL_CreateWindow("OpenGL window",
+ SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ 64, 64,
+ SDL_WINDOW_OPENGL);
+ SDL_GLContext context = SDL_GL_CreateContext(window);
+ assert(context != nullptr);
+
+ // Load pictures.
+ unsigned width1, height1, width2, height2;
+ GLuint tex0 = load_texture(argc >= (optind + 1) ? argv[optind] : "test1499.png", &width1, &height1);
+ GLuint tex1 = load_texture(argc >= (optind + 2) ? argv[optind + 1] : "test1500.png", &width2, &height2);
+
+ if (width1 != width2 || height1 != height2) {
+ fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n",
+ width1, height1, width2, height2);
+ exit(1);