Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix z transform

shun_iwasawac035859f7536
diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp
index e2658e5ec..938c85b7b 100644
--- a/toonz/sources/toonz/sceneviewer.cpp
+++ b/toonz/sources/toonz/sceneviewer.cpp
@@ -879,8 +879,10 @@ void SceneViewer::resizeGL(int w, int h) {
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
-
glOrtho(0, w, 0, h, -4000, 4000);
+ m_projectionMatrix.setToIdentity();
+ m_projectionMatrix.ortho(0, w, 0, h, -4000, 4000);
+
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.375, 0.375, 0.0);
@@ -1650,7 +1652,8 @@ double SceneViewer::projectToZ(const TPoint &delta) {
GLint viewport[4];
double modelview[16], projection[16];
glGetIntegerv(GL_VIEWPORT, viewport);
- glGetDoublev(GL_PROJECTION_MATRIX, projection);
+ for (int i = 0; i < 16; i++)
+ projection[i] = (double)m_projectionMatrix.constData()[i];
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
double ax, ay, az, bx, by, bz;
diff --git a/toonz/sources/toonz/sceneviewer.h b/toonz/sources/toonz/sceneviewer.h
index 65da54749..d199263d6 100644
--- a/toonz/sources/toonz/sceneviewer.h
+++ b/toonz/sources/toonz/sceneviewer.h
@@ -24,6 +24,8 @@
#include "pane.h"
#include "previewer.h"
+#include <QMatrix4x4>
+
//=====================================================================
// Forward declarations
@@ -141,6 +143,8 @@ class SceneViewer final : public GLWidgetForHighDpi,
bool m_isBusyOnTabletMove;
+ QMatrix4x4 m_projectionMatrix;
+
// iwsw commented out temporarily
// Ghibli3DLutUtil * m_ghibli3DLutUtil;
public: