Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -428,10 +428,14 @@ void Application::resizeGL(int width, int height) { · 427 unmodified lines | ||
| 428 | 428 | |
| 429 | 429 | glViewport(0, 0, width, height); // shouldn't this account for the menu??? |
| 430 | 430 | |
| 431 | + updateProjectionMatrix(); | |
| 432 | + glLoadIdentity(); | |
| 433 | +} | |
| 434 | + | |
| 435 | +void Application::updateProjectionMatrix() { | |
| 431 | 436 | glMatrixMode(GL_PROJECTION); |
| 432 | 437 | glLoadIdentity(); |
| 433 | 438 | |
| 434 | − // On window reshape, we need to tell OpenGL about our new setting | |
| 435 | 439 | float left, right, bottom, top, nearVal, farVal; |
| 436 | 440 | glm::vec4 nearClipPlane, farClipPlane; |
| 437 | 441 | _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); |
| @@ -445,7 +449,6 @@ void Application::resizeGL(int width, int height) { · 7 unmodified lines | ||
| 445 | 449 | glFrustum(left, right, bottom, top, nearVal, farVal); |
| 446 | 450 | |
| 447 | 451 | glMatrixMode(GL_MODELVIEW); |
| 448 | − glLoadIdentity(); | |
| 449 | 452 | } |
| 450 | 453 | |
| 451 | 454 | void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes, |
| @@ -613,7 +616,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 161 unmodified lines | ||
| 613 | 616 | } else { |
| 614 | 617 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0, 0.001, 0)); |
| 615 | 618 | } |
| 616 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 619 | + updateProjectionMatrix(); | |
| 617 | 620 | break; |
| 618 | 621 | |
| 619 | 622 | case Qt::Key_K: |
| @@ -623,7 +626,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3 unmodified lines | ||
| 623 | 626 | } else { |
| 624 | 627 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0, -0.001, 0)); |
| 625 | 628 | } |
| 626 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 629 | + updateProjectionMatrix(); | |
| 627 | 630 | break; |
| 628 | 631 | |
| 629 | 632 | case Qt::Key_J: |
| @@ -633,7 +636,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3 unmodified lines | ||
| 633 | 636 | } else { |
| 634 | 637 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0)); |
| 635 | 638 | } |
| 636 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 639 | + updateProjectionMatrix(); | |
| 637 | 640 | break; |
| 638 | 641 | |
| 639 | 642 | case Qt::Key_M: |
| @@ -643,7 +646,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3 unmodified lines | ||
| 643 | 646 | } else { |
| 644 | 647 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0.001, 0, 0)); |
| 645 | 648 | } |
| 646 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 649 | + updateProjectionMatrix(); | |
| 647 | 650 | break; |
| 648 | 651 | |
| 649 | 652 | case Qt::Key_U: |
| @@ -653,7 +656,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3 unmodified lines | ||
| 653 | 656 | } else { |
| 654 | 657 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0, 0, -0.001)); |
| 655 | 658 | } |
| 656 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 659 | + updateProjectionMatrix(); | |
| 657 | 660 | break; |
| 658 | 661 | |
| 659 | 662 | case Qt::Key_Y: |
| @@ -663,7 +666,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3 unmodified lines | ||
| 663 | 666 | } else { |
| 664 | 667 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0, 0, 0.001)); |
| 665 | 668 | } |
| 666 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 669 | + updateProjectionMatrix(); | |
| 667 | 670 | break; |
| 668 | 671 | case Qt::Key_H: |
| 669 | 672 | Menu::getInstance()->triggerOption(MenuOption::Mirror); |
| @@ -1806,12 +1809,12 @@ void Application::update(float deltaTime) { · 1136 unmodified lines | ||
| 1806 | 1809 | const float EYE_OFFSET_SCALE = 0.005f; |
| 1807 | 1810 | glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE; |
| 1808 | 1811 | _myCamera.setEyeOffsetPosition(glm::vec3(-position.x, position.y, position.z)); |
| 1809 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 1812 | + updateProjectionMatrix(); | |
| 1810 | 1813 | |
| 1811 | 1814 | } else if (_webcam.isActive()) { |
| 1812 | 1815 | const float EYE_OFFSET_SCALE = 5.0f; |
| 1813 | 1816 | _myCamera.setEyeOffsetPosition(_webcam.getEstimatedPosition() * EYE_OFFSET_SCALE); |
| 1814 | − resizeGL(_glWidget->width(), _glWidget->height()); | |
| 1817 | + updateProjectionMatrix(); | |
| 1815 | 1818 | } |
| 1816 | 1819 | } |
| 1817 | 1820 | } |