summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-08-09 14:48:12 +0200
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-08-10 11:32:46 +0200
commitac6323c4346be5fb5b1111194b2ee98706a69ffa (patch)
treee76ede8c1caa5599de91f6717eac4f4076bfbb6b
parente7eed096a0c33607a7a37baaf06e5952dc9d556b (diff)
downloadqt4-tools-ac6323c4346be5fb5b1111194b2ee98706a69ffa.tar.gz
Replace gluPerspective with qgluPerspective.
GLU dependency was removed in commit: c67b4cac2e53ae77c4e16487838c17be85e73aa3, so we have to implement the function ourselves. Reviewed-by: kim
-rw-r--r--demos/boxes/glbuffers.cpp10
-rw-r--r--demos/boxes/glbuffers.h2
-rw-r--r--demos/boxes/qtbox.cpp2
-rw-r--r--demos/boxes/scene.cpp2
4 files changed, 14 insertions, 2 deletions
diff --git a/demos/boxes/glbuffers.cpp b/demos/boxes/glbuffers.cpp
index 694d05b409..84ab26c809 100644
--- a/demos/boxes/glbuffers.cpp
+++ b/demos/boxes/glbuffers.cpp
@@ -42,6 +42,16 @@
#include "glbuffers.h"
#include <QtGui/qmatrix4x4.h>
+
+void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
+{
+ const GLdouble ymax = zNear * tan(fovy * M_PI / 360.0);
+ const GLdouble ymin = -ymax;
+ const GLdouble xmin = ymin * aspect;
+ const GLdouble xmax = ymax * aspect;
+ glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
+}
+
//============================================================================//
// GLTexture //
//============================================================================//
diff --git a/demos/boxes/glbuffers.h b/demos/boxes/glbuffers.h
index 67a4ea6ed1..8c1e209daf 100644
--- a/demos/boxes/glbuffers.h
+++ b/demos/boxes/glbuffers.h
@@ -58,6 +58,8 @@ if (m_failed || !(assertion)) {
returnStatement; \
}
+void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
+
QT_BEGIN_NAMESPACE
class QMatrix4x4;
QT_END_NAMESPACE
diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp
index 3aaf985ab9..e3a59781e9 100644
--- a/demos/boxes/qtbox.cpp
+++ b/demos/boxes/qtbox.cpp
@@ -324,7 +324,7 @@ void QtBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(moveToRectMatrix);
- gluPerspective(60.0, 1.0, 0.01, 10.0);
+ qgluPerspective(60.0, 1.0, 0.01, 10.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index 97953f2636..d65af22b9c 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -922,7 +922,7 @@ void Scene::drawBackground(QPainter *painter, const QRectF &)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
- gluPerspective(60.0, width / height, 0.01, 15.0);
+ qgluPerspective(60.0, width / height, 0.01, 15.0);
glMatrixMode(GL_MODELVIEW);