render mirror box

This commit is contained in:
stojce 2013-10-18 00:22:25 +02:00
parent 2e84d1e213
commit 63533e66c1
2 changed files with 13 additions and 2 deletions

View file

@ -425,7 +425,6 @@ void Application::paintGL() {
} else { } else {
_glowEffect.prepare(); _glowEffect.prepare();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -434,6 +433,17 @@ void Application::paintGL() {
_glowEffect.render(); _glowEffect.render();
// mirror
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
glViewport(50, 600, 265, 215);
glLogicOp(GL_CLEAR);
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
displaySide(_mirrorCamera);
glViewport(0, 0, _glWidget->width(), _glWidget->height());
}
// mirror
displayOverlay(); displayOverlay();
} }
@ -2482,7 +2492,6 @@ void Application::displaySide(Camera& whichCamera) {
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
glScalef(-1.0f, 1.0f, 1.0f); glScalef(-1.0f, 1.0f, 1.0f);
glFrontFace(GL_CW); glFrontFace(GL_CW);
} else { } else {
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
} }
@ -2770,6 +2779,7 @@ void Application::displaySide(Camera& whichCamera) {
glPopMatrix(); glPopMatrix();
} }
} }
void Application::displayOverlay() { void Application::displayOverlay() {

View file

@ -294,6 +294,7 @@ private:
Camera _myCamera; // My view onto the world Camera _myCamera; // My view onto the world
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
Camera _mirrorCamera;
Environment _environment; Environment _environment;