3 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "fbo_input.h"
21 #include <movit/util.h>
23 // comes from unexported effect_util.h
24 extern void set_uniform_int(GLuint glsl_program_num, const std::string &prefix, const std::string &key, int value);
26 FBOInput::FBOInput(unsigned width, unsigned height)
28 , needs_mipmaps(false)
32 register_int("needs_mipmaps", &needs_mipmaps);
35 void FBOInput::set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num)
37 glActiveTexture(GL_TEXTURE0 + *sampler_num);
39 glBindTexture(GL_TEXTURE_2D, texture_num);
42 // Bind it to a sampler.
43 set_uniform_int(glsl_program_num, prefix, "tex", *sampler_num);
47 std::string FBOInput::output_fragment_shader()
49 return read_file("flat_input.frag");
50 // return "uniform sampler2D PREFIX(tex); vec4 FUNCNAME(vec2 tc) { return texture2D(PREFIX(tex), tc); }\n";