43 #include "PostProcessorAnaglyphPlugin.hh" 45 #include <ACG/GL/ScreenQuad.hh> 46 #include <ACG/GL/ShaderCache.hh> 52 PostProcessorAnaglyphPlugin::PostProcessorAnaglyphPlugin()
56 PostProcessorAnaglyphPlugin::~PostProcessorAnaglyphPlugin()
60 QString PostProcessorAnaglyphPlugin::checkOpenGL() {
62 return QString(
"Insufficient OpenGL Version! OpenGL 3.0 or higher required");
69 QString PostProcessorAnaglyphPlugin::postProcessorName() {
70 return QString(
"AnaglyphStereo");
74 void PostProcessorAnaglyphPlugin::postProcess(
ACG::GLState* _glstate,
const std::vector<const PostProcessorInput*>& _input,
const PostProcessorOutput& _output) {
76 if (_input.size() != 2) {
77 std::cerr <<
"PostProcessorAnaglyphPlugin: two input images required!" << std::endl;
87 if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::AnaglyphCustom)
88 macros.push_back(
"#define ANAGLYPH_CUSTOM");
96 _input[1]->bindColorTex(1);
97 _input[0]->bindColorTex(0);
110 glColorMask(1,1,1,1);
112 glDisable(GL_DEPTH_TEST);
123 if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::AnaglyphCustom)
126 std::vector<float> le = OpenFlipper::Options::anaglyphLeftEyeColorMatrix();
127 std::vector<float> re = OpenFlipper::Options::anaglyphRightEyeColorMatrix();
131 for (
int r = 0; r < 3; ++r)
133 for (
int c = 0; c < 3; ++c)
135 ml(r,c) = le[c*3 + r];
136 mr(r,c) = re[c*3 + r];
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
void disable()
Resets to standard rendering pipeline.
void setUniformMat3(const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false)
Set 3x3fMatrix uniform to specified value.
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
void use()
Enables the program object for using.
bool openGLVersion(const int _major, const int _minor, bool _verbose)