5 #include "image_format.h"
7 // An input is a degenerate case of an effect; it represents the picture data
8 // that comes from the user. As such, it has zero “inputs” itself, and some of
9 // the normal operations don't really make sense for it.
10 class Input : public Effect {
12 Input(ImageFormat format, unsigned width, unsigned height);
14 unsigned num_inputs() const { return 0; }
16 // Create the texture itself. We cannot do this in the constructor,
17 // because we don't necessarily know all the settings (sRGB texture,
18 // mipmap generation) at that point.
21 std::string output_fragment_shader();
23 // Uploads the texture if it has changed since last time.
24 void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num);
26 // Tells the input where to fetch the actual pixel data. Note that if you change
27 // this data, you must either call set_pixel_data() again (using the same pointer
28 // is fine), or invalidate_pixel_data(). Otherwise, the texture won't be re-uploaded
29 // on subsequent frames.
30 void set_pixel_data(const unsigned char *pixel_data)
32 this->pixel_data = pixel_data;
33 invalidate_pixel_data();
36 void invalidate_pixel_data()
41 const unsigned char *get_pixel_data() const
47 ImageFormat image_format;
49 GLuint pbo, texture_num;
51 int use_srgb_texture_format, needs_mipmaps;
52 unsigned width, height, bytes_per_pixel;
53 const unsigned char *pixel_data;
56 #endif // !defined(_INPUT_H)