summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-21 02:40:34 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-21 02:40:52 (GMT)
commit8db9f834e604c3a9eda8f76eacad2a9af20dbd33 (patch)
tree0d1e7ac8df6aae69cc878f605472ffb9db3a01ae /examples
parent544900b98b2ea996f5dccc65402bb9f32b89a3c2 (diff)
downloadQt-8db9f834e604c3a9eda8f76eacad2a9af20dbd33.zip
Qt-8db9f834e604c3a9eda8f76eacad2a9af20dbd33.tar.gz
Qt-8db9f834e604c3a9eda8f76eacad2a9af20dbd33.tar.bz2
Make OpenGL overpainting example compile under OpenGL/ES 1.1
Reviewed-by: trustme
Diffstat (limited to 'examples')
-rw-r--r--examples/opengl/overpainting/glwidget.cpp12
-rw-r--r--examples/opengl/shared/qtlogo.cpp5
2 files changed, 12 insertions, 5 deletions
diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp
index 0dcccbf..f36fd4f 100644
--- a/examples/opengl/overpainting/glwidget.cpp
+++ b/examples/opengl/overpainting/glwidget.cpp
@@ -168,10 +168,10 @@ void GLWidget::paintEvent(QPaintEvent *event)
//! [7]
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
- glTranslated(0.0, 0.0, -10.0);
- glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
- glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
- glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
+ glTranslatef(0.0, 0.0, -10.0);
+ glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
+ glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
+ glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
logo->draw();
//! [7]
@@ -252,7 +252,11 @@ void GLWidget::setupViewport(int width, int height)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES
+ glOrthof(-0.5, +0.5, -0.5, 0.5, 4.0, 15.0);
+#else
glOrtho(-0.5, +0.5, -0.5, 0.5, 4.0, 15.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
//! [14]
diff --git a/examples/opengl/shared/qtlogo.cpp b/examples/opengl/shared/qtlogo.cpp
index 3294da1..b32b416 100644
--- a/examples/opengl/shared/qtlogo.cpp
+++ b/examples/opengl/shared/qtlogo.cpp
@@ -172,14 +172,17 @@ static inline void qMultMatrix(const QMatrix4x4 &mat)
{
if (sizeof(qreal) == sizeof(GLfloat))
glMultMatrixf((GLfloat*)mat.constData());
+#ifndef QT_OPENGL_ES
else if (sizeof(qreal) == sizeof(GLdouble))
glMultMatrixd((GLdouble*)mat.constData());
+#endif
else
{
GLfloat fmat[16];
qreal const *r = mat.constData();
for (int i = 0; i < 16; ++i)
fmat[i] = r[i];
+ glMultMatrixf(fmat);
}
}
@@ -188,7 +191,7 @@ void Patch::draw() const
{
glPushMatrix();
qMultMatrix(mat);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, faceColor);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, faceColor);
const GLushort *indices = geom->faces.constData();
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, indices + start);