43 #include <ACG/GL/acg_glew.hh> 45 #include "PostProcessorPhilipsStereo.hh" 47 #include <ACG/GL/ScreenQuad.hh> 52 #include "CRC/crc32.hh" 54 PostProcessorPhilipsStereoPlugin::PostProcessorPhilipsStereoPlugin():
62 return QString(
"Philips Stereo Display Output");
65 QAction* PostProcessorPhilipsStereoPlugin::optionsAction() {
66 QAction* action =
new QAction(
"Philips Stereo Options",0);
67 connect(action,SIGNAL(triggered()),
this,SLOT(slotShowOptionsMenu()));
73 QString PostProcessorPhilipsStereoPlugin::checkOpenGL() {
75 return QString(
"Insufficient OpenGL Version! OpenGL 3.0 or higher required");
80 missing +=
"GL_ARB_texture_rectangle extension missing\n";
87 void PostProcessorPhilipsStereoPlugin::postProcess(
ACG::GLState* _glstate,
const std::vector<const PostProcessorInput*>& _input,
const PostProcessorOutput& _output) {
91 pProgram_ =
GLSL::loadProgram(
"Philips/screenquad.glsl",
"Philips/Fragment42.glsl");
96 int vp_l, vp_b, vp_w, vp_h;
106 _input[0]->bindDepthTex(1);
107 _input[0]->bindColorTex(0);
109 pProgram_->setUniform(
"ColorTexture", 0);
110 pProgram_->setUniform(
"DepthStencil", 1);
116 glDisable(GL_LIGHTING);
117 glDisable(GL_COLOR_MATERIAL);
118 glDisable(GL_DEPTH_TEST);
122 glColorMask(1,1,1,1);
133 _glstate->
ortho(0, vp_w, 0, vp_h, 0, 1);
138 glColor3f(1.0, 1.0, 1.0);
153 pProgram_->disable();
155 glBindTexture(GL_TEXTURE_2D, 0);
160 uchar *header =
new uchar[6];
217 unsigned long checksum = CalcCRC32(&header[0], 6);
220 std::vector<uchar> bitVector;
223 for (
int i = 0; i < 6; i++) {
226 for (
int j = 7; j >= 0; --j) {
229 bitVector.push_back(0);
230 bitVector.push_back(0);
234 if (header[i] & (1 << j)) {
235 bitVector.push_back(255);
237 bitVector.push_back(0);
242 bitVector.push_back(0);
243 bitVector.push_back(0);
244 bitVector.push_back(0);
250 for (
int i = 31; i >= 0; i--) {
253 bitVector.push_back(0);
254 bitVector.push_back(0);
256 if (checksum & (1 << i))
257 bitVector.push_back(255);
259 bitVector.push_back(0);
263 bitVector.push_back(0);
264 bitVector.push_back(0);
265 bitVector.push_back(0);
271 glRasterPos2i(_output.viewport_[0], _output.viewport_[1] + _output.height - 1);
272 glDrawPixels(bitVector.size() / 3, 1, GL_RGB, GL_UNSIGNED_BYTE, &bitVector[0]);
void reset_modelview()
reset modelview matrix (load identity)
void pop_modelview_matrix()
pop modelview matrix
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
void push_projection_matrix()
push projection matrix
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
void reset_projection()
reset projection matrix (load identity)
void push_modelview_matrix()
push modelview matrix
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void ortho(double _left, double _right, double _bottom, double _top, double _near_plane, double _far_plane)
orthographic projection
bool openGLVersion(const int _major, const int _minor, bool _verbose)
void pop_projection_matrix()
pop projection matrix
QString postProcessorName()
announce name for the postProcessor function
bool checkExtensionSupported(const std::string &_extension)
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.