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