51 #include <ACG/GL/acg_glew.hh>
53 #include "PostProcessorPhilipsStereo.hh"
55 #include <ACG/GL/ScreenQuad.hh>
60 #include "CRC/crc32.hh"
62 PostProcessorPhilipsStereoPlugin::PostProcessorPhilipsStereoPlugin():
70 return QString(
"Philips Stereo Display Output");
73 QAction* PostProcessorPhilipsStereoPlugin::optionsAction() {
74 QAction* action =
new QAction(
"Philips Stereo Options",0);
75 connect(action,SIGNAL(triggered()),
this,SLOT(slotShowOptionsMenu()));
81 QString PostProcessorPhilipsStereoPlugin::checkOpenGL() {
83 return QString(
"Insufficient OpenGL Version! OpenGL 3.0 or higher required");
88 missing +=
"GL_ARB_texture_rectangle extension missing\n";
95 void PostProcessorPhilipsStereoPlugin::postProcess(
ACG::GLState* _glstate,
const std::vector<const PostProcessorInput*>& _input,
const PostProcessorOutput& _output) {
99 pProgram_ =
GLSL::loadProgram(
"Philips/screenquad.glsl",
"Philips/Fragment42.glsl");
104 int vp_l, vp_b, vp_w, vp_h;
114 _input[0]->bindDepthTex(1);
115 _input[0]->bindColorTex(0);
124 glDisable(GL_LIGHTING);
125 glDisable(GL_COLOR_MATERIAL);
126 glDisable(GL_DEPTH_TEST);
130 glColorMask(1,1,1,1);
141 _glstate->
ortho(0, vp_w, 0, vp_h, 0, 1);
146 glColor3f(1.0, 1.0, 1.0);
163 glBindTexture(GL_TEXTURE_2D, 0);
168 uchar *header =
new uchar[6];
225 unsigned long checksum = CalcCRC32(&header[0], 6);
228 std::vector<uchar> bitVector;
231 for (
int i = 0; i < 6; i++) {
234 for (
int j = 7; j >= 0; --j) {
237 bitVector.push_back(0);
238 bitVector.push_back(0);
242 if (header[i] & (1 << j)) {
243 bitVector.push_back(255);
245 bitVector.push_back(0);
250 bitVector.push_back(0);
251 bitVector.push_back(0);
252 bitVector.push_back(0);
258 for (
int i = 31; i >= 0; i--) {
261 bitVector.push_back(0);
262 bitVector.push_back(0);
264 if (checksum & (1 << i))
265 bitVector.push_back(255);
267 bitVector.push_back(0);
271 bitVector.push_back(0);
272 bitVector.push_back(0);
273 bitVector.push_back(0);
279 glRasterPos2i(_output.viewport_[0], _output.viewport_[1] + _output.height - 1);
280 glDrawPixels(bitVector.size() / 3, 1, GL_RGB, GL_UNSIGNED_BYTE, &bitVector[0]);
291 #if QT_VERSION < 0x050000
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
bool openGLVersion(const int _major, const int _minor)
void push_modelview_matrix()
push modelview matrix
bool checkExtensionSupported(const std::string &_extension)
void use()
Enables the program object for using.
void reset_modelview()
reset modelview matrix (load identity)
void pop_projection_matrix()
pop projection matrix
void reset_projection()
reset projection matrix (load identity)
void ortho(double _left, double _right, double _bottom, double _top, double _near_plane, double _far_plane)
orthographic projection
void pop_modelview_matrix()
pop modelview matrix
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void disable()
Resets to standard rendering pipeline.
QString postProcessorName()
announce name for the postProcessor function
void push_projection_matrix()
push projection matrix