diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-01-29 00:48:15 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-04 01:06:08 (GMT) |
commit | ad47f9cee2cd47ef566f86ca20f54e3f6da54070 (patch) | |
tree | 2c77b9ee200da679ffabea192395ec8fc4509b43 /examples | |
parent | 35988b6d5d14388004a4b51df1355d3d3a97d145 (diff) | |
download | Qt-ad47f9cee2cd47ef566f86ca20f54e3f6da54070.zip Qt-ad47f9cee2cd47ef566f86ca20f54e3f6da54070.tar.gz Qt-ad47f9cee2cd47ef566f86ca20f54e3f6da54070.tar.bz2 |
Remove obsolete OpenGL/ES CommonLite (fixed-point) support
Task-number: QTBUG-7683
Reviewed-by: Tom Cooksey
Diffstat (limited to 'examples')
-rw-r--r-- | examples/opengl/hellogl_es/cl_helper.h | 133 | ||||
-rw-r--r-- | examples/opengl/hellogl_es/glwidget.cpp | 137 | ||||
-rw-r--r-- | examples/opengl/hellogl_es/glwidget.h | 5 | ||||
-rw-r--r-- | examples/opengl/opengl.pro | 6 |
4 files changed, 72 insertions, 209 deletions
diff --git a/examples/opengl/hellogl_es/cl_helper.h b/examples/opengl/hellogl_es/cl_helper.h deleted file mode 100644 index 4f4c2bd..0000000 --- a/examples/opengl/hellogl_es/cl_helper.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef QT_OPENGL_ES_1_CL - -//! [0] -#define FLOAT2X(f) ((int) ( (f) * (65536))) -#define X2FLOAT(x) ((float)(x) / 65536.0f) - -#define f2vt(f) FLOAT2X(f) -#define vt2f(x) X2FLOAT(x) - -#define q_vertexType GLfixed -#define q_vertexTypeEnum GL_FIXED - -#define q_glFog glFogx -#define q_glFogv glFogxv -//! [0] - -#define q_glLight glLightx -#define q_glLightv glLightxv -#define q_glLightModel glLightModelx -#define q_glLightModelv glLightModelxv - -#define q_glAlphaFunc glAlphaFuncx - -#define q_glMaterial glMaterialx -#define q_glMaterialv glMaterialxv -#define q_glColor4 glColor4x - -#define q_glTexParameter glTexParameterx -#define q_glTexEnv glTexEnvx - -#define q_glOrtho glOrthox -#define q_glFrustum glFrustumx - -#define q_glTranslate glTranslatex -#define q_glScale glScalex -#define q_glRotate glRotatex -#define q_glLoadMatrix glLoadMatrixx - -#define q_glClearColor glClearColorx - -#define q_glMultMatrix glMultMatrixx - -#define q_glNormal3 glNormal3x - -#define q_glPolygonOffset glPolygonOffsetx -#define q_glPointSize glPointSizex - -//! [1] -#else - -#define f2vt(f) (f) -#define vt2f(x) (x) - -#define q_vertexType GLfloat -#define q_vertexTypeEnum GL_FLOAT - -#define q_glFog glFogf -#define q_glFogv glFogfv -//! [1] - -#define q_glLight glLightf -#define q_glLightv glLightfv -#define q_glLightModel glLightModelf -#define q_glLightModelv glLightModelfv - -#define q_glAlphaFunc glAlphaFuncf - -#define q_glMaterial glMaterialf -#define q_glMaterialv glMaterialfv -#define q_glColor4 glColor4f - -#define q_glTexParameter glTexParameterf -#define q_glTexEnv glTexEnvf - -#define q_glOrtho glOrthof -#define q_glFrustum glFrustumf - -#define q_glTranslate glTranslatef -#define q_glScale glScalef -#define q_glRotate glRotatef -#define q_glLoadMatrix glLoadMatrixf - -#define q_glClearColor glClearColor - -#define q_glMultMatrix glMultMatrixf - -#define q_glNormal3 glNormal3f - -#define q_glPolygonOffset glPolygonOffsetf -#define q_glPointSize glPointSizef - -#endif diff --git a/examples/opengl/hellogl_es/glwidget.cpp b/examples/opengl/hellogl_es/glwidget.cpp index 9a45a11..8a6543d 100644 --- a/examples/opengl/hellogl_es/glwidget.cpp +++ b/examples/opengl/hellogl_es/glwidget.cpp @@ -44,7 +44,6 @@ #include <math.h> #include "bubble.h" -#include "cl_helper.h" const int bubbleNum = 8; @@ -114,9 +113,9 @@ void GLWidget::paintQtLogo() { glDisable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,q_vertexTypeEnum,0, createdVertices); + glVertexPointer(3,GL_FLOAT,0, createdVertices); glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(q_vertexTypeEnum,0,createdNormals); + glNormalPointer(GL_FLOAT,0,createdNormals); glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3); } //! [2] @@ -125,83 +124,83 @@ void GLWidget::paintTexturedCube() { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_uiTexture); - q_vertexType afVertices[] = { - f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5), - f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5), - f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5), - - f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(-0.5), - f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5), - f2vt(-0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(-0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(0.5), - - f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5), - f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), - f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5) + GLfloat afVertices[] = { + -0.5, 0.5, 0.5, 0.5,-0.5,0.5,-0.5,-0.5,0.5, + 0.5, -0.5, 0.5, -0.5,0.5,0.5,0.5,0.5,0.5, + -0.5, -0.5, -0.5, 0.5,-0.5,-0.5,-0.5,0.5,-0.5, + 0.5, 0.5, -0.5, -0.5,0.5,-0.5,0.5,-0.5,-0.5, + + 0.5, -0.5, -0.5, 0.5,-0.5,0.5,0.5,0.5,-0.5, + 0.5, 0.5, 0.5, 0.5,0.5,-0.5,0.5,-0.5,0.5, + -0.5, 0.5, -0.5, -0.5,-0.5,0.5,-0.5,-0.5,-0.5, + -0.5, -0.5, 0.5, -0.5,0.5,-0.5,-0.5,0.5,0.5, + + 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, + -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, + -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, + 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5 }; glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,q_vertexTypeEnum,0,afVertices); - - q_vertexType afTexCoord[] = { - f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - - f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - - f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), - f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), - f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f) + glVertexPointer(3,GL_FLOAT,0,afVertices); + + GLfloat afTexCoord[] = { + 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, + 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, + 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, + 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, + + 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, + 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, + 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, + 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, + + 0.0f,1.0f, 1.0f,0.0f, 1.0f,1.0f, + 1.0f,0.0f, 0.0f,1.0f, 0.0f,0.0f, + 1.0f,0.0f, 1.0f,1.0f, 0.0f,0.0f, + 0.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f }; glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2,q_vertexTypeEnum,0,afTexCoord); + glTexCoordPointer(2,GL_FLOAT,0,afTexCoord); - q_vertexType afNormals[] = { + GLfloat afNormals[] = { - f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), - f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), - f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), - f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), + 0,0,-1, 0,0,-1, 0,0,-1, + 0,0,-1, 0,0,-1, 0,0,-1, + 0,0,1, 0,0,1, 0,0,1, + 0,0,1, 0,0,1, 0,0,1, - f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), - f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), - f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), - f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), + -1,0,0, -1,0,0, -1,0,0, + -1,0,0, -1,0,0, -1,0,0, + 1,0,0, 1,0,0, 1,0,0, + 1,0,0, 1,0,0, 1,0,0, - f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), - f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), - f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), - f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0) + 0,-1,0, 0,-1,0, 0,-1,0, + 0,-1,0, 0,-1,0, 0,-1,0, + 0,1,0, 0,1,0, 0,1,0, + 0,1,0, 0,1,0, 0,1,0 }; glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(q_vertexTypeEnum,0,afNormals); + glNormalPointer(GL_FLOAT,0,afNormals); glDrawArrays(GL_TRIANGLES, 0, 36); } void GLWidget::initializeGL () { - q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f)); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glEnable(GL_TEXTURE_2D); glGenTextures(1, &m_uiTexture); m_uiTexture = bindTexture(QImage(":/qt.png")); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); - q_vertexType aLightPosition[] = {f2vt(0.0f),f2vt(0.3f),f2vt(1.0f),f2vt(0.0f)}; + GLfloat aLightPosition[] = {0.0f,0.3f,1.0f,0.0f}; - q_glLightv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition); + glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition); m_fAngle = 0; m_fScale = 1; createGeometry(); @@ -230,12 +229,12 @@ void GLWidget::paintGL() //Since OpenGL ES does not support glPush/PopAttrib(GL_ALL_ATTRIB_BITS) //we have to take care of the states ourselves - q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f)); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); @@ -248,14 +247,14 @@ void GLWidget::paintGL() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(1.0), f2vt(0.0)); - q_glRotate(f2vt(m_fAngle), f2vt(1.0), f2vt(0.0), f2vt(0.0)); - q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(0.0), f2vt(1.0)); - q_glScale(f2vt(m_fScale), f2vt(m_fScale),f2vt(m_fScale)); - q_glTranslate(f2vt(0),f2vt(-0.2),f2vt(0)); + glRotatef(m_fAngle, 0.0f, 1.0f, 0.0f); + glRotatef(m_fAngle, 1.0f, 0.0f, 0.0f); + glRotatef(m_fAngle, 0.0f, 0.0f, 1.0f); + glScalef(m_fScale, m_fScale,m_fScale); + glTranslatef(0.0f,-0.2f,0.0f); - q_vertexType matDiff[] = {f2vt(0.40), f2vt(1.0), f2vt(0.0), f2vt(1.0)}; - q_glMaterialv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); + GLfloat matDiff[] = {0.40f, 1.0f, 0.0f, 1.0f}; + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); if (qtLogo) paintQtLogo(); @@ -376,11 +375,11 @@ void GLWidget::createGeometry() //! [1] m_vertexNumber = vertices.size(); - createdVertices = new q_vertexType[m_vertexNumber]; - createdNormals = new q_vertexType[m_vertexNumber]; + createdVertices = new GLfloat[m_vertexNumber]; + createdNormals = new GLfloat[m_vertexNumber]; for (int i = 0;i < m_vertexNumber;i++) { - createdVertices[i] = f2vt(vertices.at(i) * 2); - createdNormals[i] = f2vt(normals.at(i)); + createdVertices[i] = vertices.at(i) * 2; + createdNormals[i] = normals.at(i); } vertices.clear(); normals.clear(); diff --git a/examples/opengl/hellogl_es/glwidget.h b/examples/opengl/hellogl_es/glwidget.h index 7a8df53..3b2b5d4 100644 --- a/examples/opengl/hellogl_es/glwidget.h +++ b/examples/opengl/hellogl_es/glwidget.h @@ -45,7 +45,6 @@ #include <QGLWidget> #include <QTime> -#include "cl_helper.h" class Bubble; @@ -76,8 +75,8 @@ private: void extrude(qreal x1, qreal y1, qreal x2, qreal y2); QList<qreal> vertices; QList<qreal> normals; - q_vertexType *createdVertices; - q_vertexType *createdNormals; + GLfloat *createdVertices; + GLfloat *createdNormals; int m_vertexNumber; bool qtLogo; QList<Bubble*> bubbles; diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index eaac9b8..c3fbc77 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -1,14 +1,12 @@ TEMPLATE = subdirs -contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles1cl)|contains(QT_CONFIG, opengles2){ +contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ contains(QT_CONFIG, opengles2) { SUBDIRS = hellogl_es2 } else { SUBDIRS = hellogl_es } - !contains(QT_CONFIG, opengles1cl) { - SUBDIRS += textures - } + SUBDIRS += textures contains(QT_CONFIG, opengles1) { SUBDIRS += hellogl } |