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);
117 pProgram_->setUniform(
"ColorTexture", 0);
118 pProgram_->setUniform(
"DepthStencil", 1);
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);
161 pProgram_->disable();
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 void push_projection_matrix()
push projection matrix
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
void pop_projection_matrix()
pop projection matrix
void push_modelview_matrix()
push modelview matrix
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
void ortho(double _left, double _right, double _bottom, double _top, double _near_plane, double _far_plane)
orthographic projection
QString postProcessorName()
announce name for the postProcessor function
bool openGLVersion(const int _major, const int _minor)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void pop_modelview_matrix()
pop modelview matrix
void reset_projection()
reset projection matrix (load identity)
bool checkExtensionSupported(const std::string &_extension)
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
void reset_modelview()
reset modelview matrix (load identity)