Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/opengl/hellogl_es/glwidget.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    77** This file is part of the examples of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
    10 ** Commercial Usage
    11 ** Licensees holding valid Qt Commercial licenses may use this file in
    12 ** accordance with the Qt Commercial License Agreement provided with the
    13 ** Software or, alternatively, in accordance with the terms contained in
    14 ** a written agreement between you and Nokia.
    15 **
    16 ** GNU Lesser General Public License Usage
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
    18 ** General Public License version 2.1 as published by the Free Software
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
    20 ** packaging of this file.  Please review the following information to
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    23 **
    24 ** In addition, as a special exception, Nokia gives you certain additional
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    27 **
    28 ** GNU General Public License Usage
    29 ** Alternatively, this file may be used under the terms of the GNU
    30 ** General Public License version 3.0 as published by the Free Software
    31 ** Foundation and appearing in the file LICENSE.GPL included in the
    32 ** packaging of this file.  Please review the following information to
    33 ** ensure the GNU General Public License version 3.0 requirements will be
    34 ** met: http://www.gnu.org/copyleft/gpl.html.
    35 **
    36 ** If you have questions regarding the use of this file, please contact
    37 ** Nokia at [email protected].
     9** $QT_BEGIN_LICENSE:BSD$
     10** You may use this file under the terms of the BSD license as follows:
     11**
     12** "Redistribution and use in source and binary forms, with or without
     13** modification, are permitted provided that the following conditions are
     14** met:
     15**   * Redistributions of source code must retain the above copyright
     16**     notice, this list of conditions and the following disclaimer.
     17**   * Redistributions in binary form must reproduce the above copyright
     18**     notice, this list of conditions and the following disclaimer in
     19**     the documentation and/or other materials provided with the
     20**     distribution.
     21**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
     22**     the names of its contributors may be used to endorse or promote
     23**     products derived from this software without specific prior written
     24**     permission.
     25**
     26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    3837** $QT_END_LICENSE$
    3938**
     
    4544
    4645#include "bubble.h"
    47 #include "cl_helper.h"
    4846
    4947
     
    115113    glDisable(GL_TEXTURE_2D);
    116114    glEnableClientState(GL_VERTEX_ARRAY);
    117     glVertexPointer(3,q_vertexTypeEnum,0, createdVertices);
     115    glVertexPointer(3,,0, createdVertices);
    118116    glEnableClientState(GL_NORMAL_ARRAY);
    119     glNormalPointer(q_vertexTypeEnum,0,createdNormals);
     117    glNormalPointer(,0,createdNormals);
    120118    glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3);
    121119}
     
    126124    glEnable(GL_TEXTURE_2D);
    127125    glBindTexture(GL_TEXTURE_2D, m_uiTexture);
    128     q_vertexType afVertices[] = {
    129         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),
    130         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),
    131         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),
    132         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),
    133 
    134         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),
    135         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),
    136         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),
    137         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),
    138 
    139         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),
    140         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),
    141         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),
    142         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)
     126    afVertices[] = {
     127        ,
     128        ,
     129        ,
     130        ,
     131
     132        ,
     133        ,
     134        ,
     135        ,
     136
     137        ,
     138        ,
     139        ,
     140       
    143141    };
    144142    glEnableClientState(GL_VERTEX_ARRAY);
    145     glVertexPointer(3,q_vertexTypeEnum,0,afVertices);
    146 
    147     q_vertexType afTexCoord[] = {
    148         f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f),
    149         f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f),
    150         f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f),
    151         f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f),
    152 
    153         f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f),
    154         f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f),
    155         f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f),
    156         f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f),
    157 
    158         f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f),
    159         f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f),
    160         f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f),
    161         f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f)
     143    glVertexPointer(3,,0,afVertices);
     144
     145    afTexCoord[] = {
     146        ,
     147        ,
     148        ,
     149        ,
     150
     151        ,
     152        ,
     153        ,
     154        ,
     155
     156        ,
     157        ,
     158        ,
     159       
    162160    };
    163161    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    164     glTexCoordPointer(2,q_vertexTypeEnum,0,afTexCoord);
    165 
    166     q_vertexType afNormals[] = {
    167 
    168         f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1),
    169         f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1),
    170         f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1),
    171         f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1),
    172 
    173         f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0),
    174         f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0),
    175         f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0),
    176         f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0),
    177 
    178         f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0),
    179         f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0),
    180         f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0),
    181         f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0)
     162    glTexCoordPointer(2,,0,afTexCoord);
     163
     164    afNormals[] = {
     165
     166        ,
     167        ,
     168        ,
     169        ,
     170
     171        ,
     172        ,
     173        ,
     174        ,
     175
     176        ,
     177        ,
     178        ,
     179       
    182180    };
    183181    glEnableClientState(GL_NORMAL_ARRAY);
    184     glNormalPointer(q_vertexTypeEnum,0,afNormals);
     182    glNormalPointer(,0,afNormals);
    185183
    186184    glDrawArrays(GL_TRIANGLES, 0, 36);
     
    189187void GLWidget::initializeGL ()
    190188{
    191     q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f));
     189    );
    192190
    193191    glEnable(GL_TEXTURE_2D);
     
    195193    m_uiTexture = bindTexture(QImage(":/qt.png"));
    196194
    197     q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    198     q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     195    (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
     196    (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    199197    glEnable(GL_LIGHTING);
    200198    glEnable(GL_LIGHT0);
    201199
    202     q_vertexType aLightPosition[] = {f2vt(0.0f),f2vt(0.3f),f2vt(1.0f),f2vt(0.0f)};
    203 
    204     q_glLightv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition);
     200    };
     201
     202    v(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition);
    205203    m_fAngle = 0;
    206204    m_fScale = 1;
     
    231229    //we have to take care of the states ourselves
    232230
    233     q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f));
     231    );
    234232    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    235233    glEnable(GL_TEXTURE_2D);
    236234
    237     q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    238     q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     235    (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
     236    (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    239237    glEnable(GL_LIGHTING);
    240238    glEnable(GL_LIGHT0);
     
    249247    glLoadIdentity();
    250248
    251     q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(1.0), f2vt(0.0));
    252     q_glRotate(f2vt(m_fAngle), f2vt(1.0), f2vt(0.0), f2vt(0.0));
    253     q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(0.0), f2vt(1.0));
    254     q_glScale(f2vt(m_fScale), f2vt(m_fScale),f2vt(m_fScale));
    255     q_glTranslate(f2vt(0),f2vt(-0.2),f2vt(0));
    256 
    257     q_vertexType matDiff[] = {f2vt(0.40), f2vt(1.0), f2vt(0.0), f2vt(1.0)};
    258     q_glMaterialv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
     249    );
     250    );
     251    );
     252    );
     253    );
     254
     255    };
     256    v(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
    259257
    260258    if (qtLogo)
     
    377375//! [1]
    378376    m_vertexNumber = vertices.size();
    379     createdVertices = new q_vertexType[m_vertexNumber];
    380     createdNormals = new q_vertexType[m_vertexNumber];
     377    createdVertices = new [m_vertexNumber];
     378    createdNormals = new [m_vertexNumber];
    381379    for (int i = 0;i < m_vertexNumber;i++) {
    382       createdVertices[i] = f2vt(vertices.at(i) * 2);
    383       createdNormals[i] = f2vt(normals.at(i));
     380      createdVertices[i] = ;
     381      createdNormals[i] = );
    384382    }
    385383    vertices.clear();
Note: See TracChangeset for help on using the changeset viewer.