Commit 6d9dc093 authored by Christopher Tenter's avatar Christopher Tenter

improve postprocessor interface refs #2307

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@19858 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 45604c4c
......@@ -59,12 +59,23 @@ struct PostProcessorInput
GLuint _depthTex = 0,
int _width = 0,
int _height = 0)
: colorTex_(_colTex), depthTex_(_depthTex), width(_width), height(_height) {}
: colorTex_(_colTex), depthTex_(_depthTex), width(_width), height(_height)
{
view_.identity();
proj_.identity();
depthRange_[0] = 0.0; depthRange_[1] = 1.0f;
}
GLuint colorTex_;
GLuint depthTex_;
int width, height;
// view and projection matrix
ACG::GLMatrixf view_;
ACG::GLMatrixf proj_;
float depthRange_[2];
};
......@@ -74,7 +85,7 @@ struct PostProcessorOutput
GLuint _drawBuffer = 0,
int _width = 0,
int _height = 0)
: fbo_(_fbo), drawBuffer_(_drawBuffer), width(_width), height(_height) {}
: fbo_(_fbo), drawBuffer_(_drawBuffer), width(_width), height(_height) { }
// opengl fbo id
GLuint fbo_;
......
......@@ -659,10 +659,13 @@ void glViewer::drawScene()
bool stereoOpenGL = false;
bool stereoAnaglyph = false;
ACG::GLMatrixd projSave = glstate_->projection();
ACG::GLMatrixd projLR[2];
if (properties_.stereo()) {
stereoOpenGL = OpenFlipper::Options::stereoMode () == OpenFlipper::Options::OpenGL && OpenFlipper::Options::glStereo ();
stereoAnaglyph = !stereoOpenGL;
computeProjStereo(glstate_->viewport_width(), glstate_->viewport_height(), properties_, projLR, projLR+1);
}
// Check if we use build in default renderer
......@@ -685,10 +688,6 @@ void glViewer::drawScene()
glGetIntegerv(GL_DRAW_BUFFER, (GLint*)&backbufferTarget);
// setup stereo rendering
ACG::GLMatrixd projSave = glstate_->projection();
ACG::GLMatrixd projLR[2];
computeProjStereo(glstate_->viewport_width(), glstate_->viewport_height(), properties_, projLR, projLR+1);
updateStereoFBOs(glstate_->viewport_width(), glstate_->viewport_height());
......@@ -765,12 +764,26 @@ void glViewer::drawScene()
postProcInput.depthTex_ = readBackFbo_.getAttachment(GL_DEPTH_ATTACHMENT);
postProcInput.width = readBackFbo_.width();
postProcInput.height = readBackFbo_.height();
postProcInput.view_ = glstate_->modelview();
postProcInput.proj_ = glstate_->projection();
GLclampd range[2];
glstate_->getDepthRange(range, range+1);
postProcInput.depthRange_[0] = float(range[0]);
postProcInput.depthRange_[1] = float(range[1]);
}
else {
postProcInput.colorTex_ = stereoFBO_[chainId].getAttachment(GL_COLOR_ATTACHMENT0);
postProcInput.depthTex_ = stereoFBO_[chainId].getAttachment(GL_DEPTH_ATTACHMENT);
postProcInput.width = stereoFBO_[chainId].width();
postProcInput.height = stereoFBO_[chainId].height();
postProcInput.view_ = glstate_->modelview();
postProcInput.proj_ = glstate_->projection();
GLclampd range[2];
glstate_->getDepthRange(range, range+1);
postProcInput.depthRange_[0] = float(range[0]);
postProcInput.depthRange_[1] = float(range[1]);
}
resolveStereoAnaglyph[chainId].colorTex_ = stereoFBO_[chainId].getAttachment(GL_COLOR_ATTACHMENT0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment