Changed from GLdouble to GLfloat. Apparently the performance difference is greater on the GPU..? It doesn't really matter but let's be consistent.

Wed, 08 Feb 2017 16:45:32 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 08 Feb 2017 16:45:32 +0200
changeset 1094
8a419cead363
parent 1093
3fb96ed48e49
child 1095
cb58a160bed3

Changed from GLdouble to GLfloat. Apparently the performance difference is greater on the GPU..? It doesn't really matter but let's be consistent.

src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/glRenderer.h file | annotate | diff | comparison | revisions
--- a/src/glRenderer.cpp	Wed Feb 08 16:38:59 2017 +0200
+++ b/src/glRenderer.cpp	Wed Feb 08 16:45:32 2017 +0200
@@ -214,9 +214,9 @@
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
 	glLoadIdentity();
-	glRotated(30, 1, 0, 0);
-	glRotated(330, 0, 1, 0);
-	glGetDoublev(GL_MODELVIEW_MATRIX, currentDocumentData().rotationMatrix);
+	glRotatef(30, 1, 0, 0);
+	glRotatef(330, 0, 1, 0);
+	glGetFloatv(GL_MODELVIEW_MATRIX, currentDocumentData().rotationMatrix);
 	glPopMatrix();
 	panning(X) = panning(Y) = 0.0f;
 	needZoomToFit();
@@ -406,7 +406,7 @@
 		glLoadIdentity();
 		glTranslatef(0.0f, 0.0f, -2.0f);
 		glTranslatef(panning (X), panning (Y), -zoom());
-		glMultMatrixd(currentDocumentData().rotationMatrix);
+		glMultMatrixf(currentDocumentData().rotationMatrix);
 	}
 
 	glEnableClientState (GL_VERTEX_ARRAY);
@@ -612,7 +612,7 @@
 #ifndef RELEASE
 	{
 		QString text = format("Rotation: %1\nPanning: (%2, %3), Zoom: %4",
-		    QGenericMatrix<4, 4, GLdouble>(currentDocumentData().rotationMatrix), panning(X), panning(Y), zoom());
+		    QGenericMatrix<4, 4, GLfloat>(currentDocumentData().rotationMatrix), panning(X), panning(Y), zoom());
 		QRect textSize = metrics.boundingRect(0, 0, m_width, m_height, Qt::AlignCenter, text);
 		painter.setPen(textPen());
 		painter.drawText((width() - textSize.width()) / 2, height() - textSize.height(), textSize.width(),
@@ -807,9 +807,9 @@
 			glPushMatrix();
 			glLoadIdentity();
 			// 0.6 is an arbitrary rotation sensitivity scalar
-			glRotated(0.6 * hypot(xMove, yMove), yMove, xMove, 0);
-			glMultMatrixd(currentDocumentData().rotationMatrix);
-			glGetDoublev(GL_MODELVIEW_MATRIX, currentDocumentData().rotationMatrix);
+			glRotatef(0.6 * hypot(xMove, yMove), yMove, xMove, 0);
+			glMultMatrixf(currentDocumentData().rotationMatrix);
+			glGetFloatv(GL_MODELVIEW_MATRIX, currentDocumentData().rotationMatrix);
 			glPopMatrix();
 			m_isCameraMoving = true;
 		}
--- a/src/glRenderer.h	Wed Feb 08 16:38:59 2017 +0200
+++ b/src/glRenderer.h	Wed Feb 08 16:45:32 2017 +0200
@@ -69,7 +69,7 @@
 //
 struct LDGLData
 {
-	GLdouble		rotationMatrix[16];
+	GLfloat			rotationMatrix[16];
 	double			panX[7];
 	double			panY[7];
 	double			zoom[7];

mercurial