After we made the different ImageInput instances share OpenGL textures,
some of them would assume they could output sRGB. Fix by the same way
we've done video textures, ie., use sRGBSwitchingInput.
using namespace std;
ImageInput::ImageInput(const string &filename)
using namespace std;
ImageInput::ImageInput(const string &filename)
- : movit::FlatInput({movit::COLORSPACE_sRGB, movit::GAMMA_sRGB}, movit::FORMAT_RGBA_POSTMULTIPLIED_ALPHA,
- GL_UNSIGNED_BYTE, 1280, 720), // Resolution will be overwritten.
+ : sRGBSwitchingFlatInput({movit::COLORSPACE_sRGB, movit::GAMMA_sRGB}, movit::FORMAT_RGBA_POSTMULTIPLIED_ALPHA,
+ GL_UNSIGNED_BYTE, 1280, 720), // Resolution will be overwritten.
pathname(search_for_file_or_die(filename)),
current_image(load_image(filename, pathname))
{
pathname(search_for_file_or_die(filename)),
current_image(load_image(filename, pathname))
{
set_texture_num(*current_image->tex);
}
}
set_texture_num(*current_image->tex);
}
}
- movit::FlatInput::set_gl_state(glsl_program_num, prefix, sampler_num);
+ sRGBSwitchingFlatInput::set_gl_state(glsl_program_num, prefix, sampler_num);
}
shared_ptr<const ImageInput::Image> ImageInput::load_image(const string &filename, const string &pathname)
}
shared_ptr<const ImageInput::Image> ImageInput::load_image(const string &filename, const string &pathname)
check_error();
glPixelStorei(GL_UNPACK_ROW_LENGTH, linesizes[0] / 4);
check_error();
check_error();
glPixelStorei(GL_UNPACK_ROW_LENGTH, linesizes[0] / 4);
check_error();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, frame->width, frame->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data.get());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, frame->width, frame->height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, image_data.get());
check_error();
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
check_error();
check_error();
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
check_error();
#include <thread>
#include "ref_counted_texture.h"
#include <thread>
#include "ref_counted_texture.h"
+#include "tweaked_inputs.h"
class QSurface;
// An output that takes its input from a static image, loaded with ffmpeg.
// comes from a single 2D array with chunky pixels. The image is refreshed
// from disk about every second.
class QSurface;
// An output that takes its input from a static image, loaded with ffmpeg.
// comes from a single 2D array with chunky pixels. The image is refreshed
// from disk about every second.
-class ImageInput : public movit::FlatInput {
+class ImageInput : public sRGBSwitchingFlatInput {
public:
// NOTE: You will need to call start_update_thread() yourself, once per program.
ImageInput(const std::string &filename);
public:
// NOTE: You will need to call start_update_thread() yourself, once per program.
ImageInput(const std::string &filename);