50 #include "PostProcessorAnaglyphPlugin.hh"
52 #include <ACG/GL/ScreenQuad.hh>
53 #include <ACG/GL/ShaderCache.hh>
59 PostProcessorAnaglyphPlugin::PostProcessorAnaglyphPlugin()
63 PostProcessorAnaglyphPlugin::~PostProcessorAnaglyphPlugin()
67 QString PostProcessorAnaglyphPlugin::checkOpenGL() {
69 return QString(
"Insufficient OpenGL Version! OpenGL 3.0 or higher required");
76 QString PostProcessorAnaglyphPlugin::postProcessorName() {
77 return QString(
"AnaglyphStereo");
81 void PostProcessorAnaglyphPlugin::postProcess(
ACG::GLState* _glstate,
const std::vector<const PostProcessorInput*>& _input,
const PostProcessorOutput& _output) {
83 if (_input.size() != 2) {
84 std::cerr <<
"PostProcessorAnaglyphPlugin: two input images required!" << std::endl;
94 if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::AnaglyphCustom)
95 macros.push_back(
"#define ANAGLYPH_CUSTOM");
103 _input[1]->bindColorTex(1);
104 _input[0]->bindColorTex(0);
117 glColorMask(1,1,1,1);
119 glDisable(GL_DEPTH_TEST);
130 if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::AnaglyphCustom)
133 std::vector<float> le = OpenFlipper::Options::anaglyphLeftEyeColorMatrix();
134 std::vector<float> re = OpenFlipper::Options::anaglyphRightEyeColorMatrix();
138 for (
int r = 0; r < 3; ++r)
140 for (
int c = 0; c < 3; ++c)
142 ml(r,c) = le[c*3 + r];
143 mr(r,c) = re[c*3 + r];
162 #if QT_VERSION < 0x050000
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
bool openGLVersion(const int _major, const int _minor)
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
void use()
Enables the program object for using.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
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.