Changeset 561 for trunk/examples/opengl


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
74 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/opengl/2dpainting/2dpainting.pro

    r2 r561  
    1616sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/2dpainting
    1717INSTALLS += target sources
     18
     19symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/2dpainting/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/helper.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/helper.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/widget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/widget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/window.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/2dpainting/window.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/framebufferobject/bubbles.svg

    r2 r561  
    7373                      cx="0" cy="0" r="100" fx="-50" fy="50">
    7474        <stop offset="0%" stop-color="black" stop-opacity="1.0" />
    75         <stop offset="100%" stop-color="white" stop-opacity="0.0" />
     75        <stop offset="100%" stop-color="black" stop-opacity="0.0" />
    7676      </radialGradient>
    7777
     
    9292  <g transform="translate(200,700)">
    9393    <use xlink:href="#bubble" fill="url(#blueBubble)" />
    94     <animateTransform attributeName="transform" type="translate"
     94    <animateTransform attributeName="transform" type="translate" additive="sum"
    9595        values="0,0; 0,-800" begin="1s" dur="10s" fill="freeze" repeatCount="indefinite" />
    9696  </g>
     
    9999      <use xlink:href="#bubble" fill="url(#redBubble)" />
    100100    </g>
    101     <animateTransform attributeName="transform" type="translate"
     101    <animateTransform attributeName="transform" type="translate" additive="sum"
    102102        values="0,0; 0,-800" begin="3s" dur="7s" fill="freeze" repeatCount="indefinite" />
    103103  </g>
     
    106106      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    107107    </g>
    108     <animateTransform attributeName="transform" type="translate"
     108    <animateTransform attributeName="transform" type="translate" additive="sum"
    109109        values="0,0; 0,-800" begin="5s" dur="9s" fill="freeze" repeatCount="indefinite" />
    110110  </g>
     
    113113      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    114114    </g>
    115     <animateTransform attributeName="transform" type="translate"
     115    <animateTransform attributeName="transform" type="translate" additive="sum"
    116116        values="0,0; 0,-800" begin="2s" dur="6s" fill="freeze" repeatCount="indefinite" />
    117117  </g>
     
    120120      <use xlink:href="#bubble" fill="url(#blueBubble)" />
    121121    </g>
    122     <animateTransform attributeName="transform" type="translate"
     122    <animateTransform attributeName="transform" type="translate" additive="sum"
    123123        values="0,0; 0,-800" begin="4s" dur="8s" fill="freeze" repeatCount="indefinite" />
    124124  </g>
     
    127127      <use xlink:href="#bubble" fill="url(#redBubble)" />
    128128    </g>
    129     <animateTransform attributeName="transform" type="translate"
     129    <animateTransform attributeName="transform" type="translate" additive="sum"
    130130        values="0,0; 0,-800" begin="1s" dur="4s" fill="freeze" repeatCount="indefinite" />
    131131  </g>
     
    134134      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    135135    </g>
    136     <animateTransform attributeName="transform" type="translate"
     136    <animateTransform attributeName="transform" type="translate" additive="sum"
    137137        values="0,0; 0,-800" begin="0s" dur="11s" fill="freeze" repeatCount="indefinite" />
    138138  </g>
     
    141141      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    142142    </g>
    143     <animateTransform attributeName="transform" type="translate"
     143    <animateTransform attributeName="transform" type="translate" additive="sum"
    144144        values="0,0; 0,-800" begin="3s" dur="7.5s" fill="freeze" repeatCount="indefinite" />
    145145  </g>
     
    149149      <use xlink:href="#bubble" fill="url(#blueBubble)" />
    150150    </g>
    151     <animateTransform attributeName="transform" type="translate"
     151    <animateTransform attributeName="transform" type="translate" additive="sum"
    152152        values="0,0; 0,-800" begin="3s" dur="6s" fill="freeze" repeatCount="indefinite" />
    153153  </g>
     
    156156      <use xlink:href="#bubble" fill="url(#redBubble)" />
    157157    </g>
    158     <animateTransform attributeName="transform" type="translate"
     158    <animateTransform attributeName="transform" type="translate" additive="sum"
    159159        values="0,0; 0,-800" begin="5.5s" dur="7s" fill="freeze" repeatCount="indefinite" />
    160160  </g>
     
    163163      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    164164    </g>
    165     <animateTransform attributeName="transform" type="translate"
     165    <animateTransform attributeName="transform" type="translate" additive="sum"
    166166        values="0,0; 0,-800" begin="1s" dur="9s" fill="freeze" repeatCount="indefinite" />
    167167  </g>
     
    170170      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    171171    </g>
    172     <animateTransform attributeName="transform" type="translate"
     172    <animateTransform attributeName="transform" type="translate" additive="sum"
    173173        values="0,0; 0,-800" begin="2s" dur="9.5s" fill="freeze" repeatCount="indefinite" />
    174174  </g>
     
    187187      <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
    188188                            L -11,22 L -1,12 Z" />
    189       <animateTransform attributeName="transform"  type="rotate" values="0; 360"
     189      <animateTransform attributeName="transform"  type="rotate" additive="sum" values="0; 360"
    190190                 begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" />
    191191    </g>
  • trunk/examples/opengl/framebufferobject/framebufferobject.pro

    r2 r561  
    2121INSTALLS += target sources
    2222
     23symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
     24
  • trunk/examples/opengl/framebufferobject/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5454    setWindowTitle(tr("OpenGL framebuffer objects"));
    5555    makeCurrent();
    56     fbo = new QGLFramebufferObject(1024, 1024);
     56
     57    if (QGLFramebufferObject::hasOpenGLFramebufferBlit()) {
     58        QGLFramebufferObjectFormat format;
     59        format.setSamples(4);
     60        format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
     61
     62        render_fbo = new QGLFramebufferObject(512, 512, format);
     63        texture_fbo = new QGLFramebufferObject(512, 512);
     64    } else {
     65        render_fbo = new QGLFramebufferObject(1024, 1024);
     66        texture_fbo = render_fbo;
     67    }
     68
    5769    rot_x = rot_y = rot_z = 0.0f;
    5870    scale = 0.1f;
     
    114126    delete[] wave;
    115127    glDeleteLists(tile_list, 1);
    116     delete fbo;
     128    delete texture_fbo;
     129    if (render_fbo != texture_fbo)
     130        delete render_fbo;
    117131}
    118132
     
    130144
    131145    // render the 'bubbles.svg' file into our framebuffer object
    132     QPainter fbo_painter(fbo);
     146    QPainter fbo_painter(render_fbo);
    133147    svg_renderer->render(&fbo_painter);
    134148    fbo_painter.end();
     149
     150    if (render_fbo != texture_fbo) {
     151        QRect rect(0, 0, render_fbo->width(), render_fbo->height());
     152        QGLFramebufferObject::blitFramebuffer(texture_fbo, rect,
     153                                              render_fbo, rect);
     154    }
    135155
    136156    // draw into the GL widget
     
    146166    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    147167
    148     glBindTexture(GL_TEXTURE_2D, fbo->texture());
     168    glBindTexture(GL_TEXTURE_2D, texture_fbo->texture());
    149169    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     170    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    150171    glEnable(GL_TEXTURE_2D);
    151172    glEnable(GL_MULTISAMPLE);
  • trunk/examples/opengl/framebufferobject/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7878    QTimeLine *anim;
    7979    QSvgRenderer *svg_renderer;
    80     QGLFramebufferObject *fbo;
     80    QGLFramebufferObject *render_fbo;
     81    QGLFramebufferObject *texture_fbo;
    8182};
    8283
  • trunk/examples/opengl/framebufferobject/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/framebufferobject2/framebufferobject2.pro

    r2 r561  
    1010sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/framebufferobject2
    1111INSTALLS += target sources
     12
     13symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/framebufferobject2/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    209209        for (int x = 0; x < 5; ++x) {
    210210            glTranslatef(2.0f, 0, 0);
    211             glColor4f(0.8, 0.8, 0.8, 1.0);
     211            glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
    212212            glDrawArrays(GL_QUADS, 0, 4);
    213213        }
  • trunk/examples/opengl/framebufferobject2/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/framebufferobject2/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/grabber/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/grabber/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/grabber/grabber.pro

    r2 r561  
    1111sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/grabber
    1212INSTALLS += target sources
     13
     14symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/grabber/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/grabber/mainwindow.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    137137
    138138    exitAct = new QAction(tr("E&xit"), this);
    139     exitAct->setShortcut(tr("Ctrl+Q"));
     139    exitAct->setShortcuts(QKeySequence::Quit);
    140140    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
    141141
  • trunk/examples/opengl/grabber/mainwindow.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646
    4747#include "glwidget.h"
     48#include "qtlogo.h"
     49
     50#ifndef GL_MULTISAMPLE
     51#define GL_MULTISAMPLE  0x809D
     52#endif
    4853
    4954//! [0]
    5055GLWidget::GLWidget(QWidget *parent)
    51     : QGLWidget(parent)
    52 {
    53     object = 0;
     56    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
     57{
     58    logo = 0;
    5459    xRot = 0;
    5560    yRot = 0;
    5661    zRot = 0;
    5762
    58     trolltechGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
    59     trolltechPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
     63    qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
     64    qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
    6065}
    6166//! [0]
     
    6469GLWidget::~GLWidget()
    6570{
    66     makeCurrent();
    67     glDeleteLists(object, 1);
    6871}
    6972//! [1]
     
    8487//! [4]
    8588
     89static void qNormalizeAngle(int &angle)
     90{
     91    while (angle < 0)
     92        angle += 360 * 16;
     93    while (angle > 360 * 16)
     94        angle -= 360 * 16;
     95}
     96
    8697//! [5]
    8798void GLWidget::setXRotation(int angle)
    8899{
    89     normalizeAngle(&angle);
     100    qNormalizeAngle(angle);
    90101    if (angle != xRot) {
    91102        xRot = angle;
     
    98109void GLWidget::setYRotation(int angle)
    99110{
    100     normalizeAngle(&angle);
     111    qNormalizeAngle(angle);
    101112    if (angle != yRot) {
    102113        yRot = angle;
     
    108119void GLWidget::setZRotation(int angle)
    109120{
    110     normalizeAngle(&angle);
     121    qNormalizeAngle(angle);
    111122    if (angle != zRot) {
    112123        zRot = angle;
     
    119130void GLWidget::initializeGL()
    120131{
    121     qglClearColor(trolltechPurple.dark());
    122     object = makeObject();
    123     glShadeModel(GL_FLAT);
     132    qglClearColor(qtPurple.dark());
     133
     134    logo = new QtLogo(this, 64);
     135    logo->setColor(qtGreen.dark());
     136
    124137    glEnable(GL_DEPTH_TEST);
    125138    glEnable(GL_CULL_FACE);
     139    glShadeModel(GL_SMOOTH);
     140    glEnable(GL_LIGHTING);
     141    glEnable(GL_LIGHT0);
     142    glEnable(GL_MULTISAMPLE);
     143    static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
     144    glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
    126145}
    127146//! [6]
     
    132151    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    133152    glLoadIdentity();
    134     glTranslated(0.0, 0.0, -10.0);
    135     glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
    136     glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
    137     glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
    138     glCallList(object);
     153    glTranslatef(0.0, 0.0, -10.0);
     154    glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
     155    glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
     156    glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
     157    logo->draw();
    139158}
    140159//! [7]
     
    148167    glMatrixMode(GL_PROJECTION);
    149168    glLoadIdentity();
    150     glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
     169#ifdef QT_OPENGL_ES_1
     170    glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0);
     171#else
     172    glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0);
     173#endif
    151174    glMatrixMode(GL_MODELVIEW);
    152175}
     
    176199}
    177200//! [10]
    178 
    179 GLuint GLWidget::makeObject()
    180 {
    181     GLuint list = glGenLists(1);
    182     glNewList(list, GL_COMPILE);
    183 
    184     glBegin(GL_QUADS);
    185 
    186     GLdouble x1 = +0.06;
    187     GLdouble y1 = -0.14;
    188     GLdouble x2 = +0.14;
    189     GLdouble y2 = -0.06;
    190     GLdouble x3 = +0.08;
    191     GLdouble y3 = +0.00;
    192     GLdouble x4 = +0.30;
    193     GLdouble y4 = +0.22;
    194 
    195     quad(x1, y1, x2, y2, y2, x2, y1, x1);
    196     quad(x3, y3, x4, y4, y4, x4, y3, x3);
    197 
    198     extrude(x1, y1, x2, y2);
    199     extrude(x2, y2, y2, x2);
    200     extrude(y2, x2, y1, x1);
    201     extrude(y1, x1, x1, y1);
    202     extrude(x3, y3, x4, y4);
    203     extrude(x4, y4, y4, x4);
    204     extrude(y4, x4, y3, x3);
    205 
    206     const double Pi = 3.14159265358979323846;
    207     const int NumSectors = 200;
    208 
    209     for (int i = 0; i < NumSectors; ++i) {
    210         double angle1 = (i * 2 * Pi) / NumSectors;
    211         GLdouble x5 = 0.30 * sin(angle1);
    212         GLdouble y5 = 0.30 * cos(angle1);
    213         GLdouble x6 = 0.20 * sin(angle1);
    214         GLdouble y6 = 0.20 * cos(angle1);
    215 
    216         double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
    217         GLdouble x7 = 0.20 * sin(angle2);
    218         GLdouble y7 = 0.20 * cos(angle2);
    219         GLdouble x8 = 0.30 * sin(angle2);
    220         GLdouble y8 = 0.30 * cos(angle2);
    221 
    222         quad(x5, y5, x6, y6, x7, y7, x8, y8);
    223 
    224         extrude(x6, y6, x7, y7);
    225         extrude(x8, y8, x5, y5);
    226     }
    227 
    228     glEnd();
    229 
    230     glEndList();
    231     return list;
    232 }
    233 
    234 void GLWidget::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
    235                     GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
    236 {
    237     qglColor(trolltechGreen);
    238 
    239     glVertex3d(x1, y1, -0.05);
    240     glVertex3d(x2, y2, -0.05);
    241     glVertex3d(x3, y3, -0.05);
    242     glVertex3d(x4, y4, -0.05);
    243 
    244     glVertex3d(x4, y4, +0.05);
    245     glVertex3d(x3, y3, +0.05);
    246     glVertex3d(x2, y2, +0.05);
    247     glVertex3d(x1, y1, +0.05);
    248 }
    249 
    250 void GLWidget::extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
    251 {
    252     qglColor(trolltechGreen.dark(250 + int(100 * x1)));
    253 
    254     glVertex3d(x1, y1, +0.05);
    255     glVertex3d(x2, y2, +0.05);
    256     glVertex3d(x2, y2, -0.05);
    257     glVertex3d(x1, y1, -0.05);
    258 }
    259 
    260 void GLWidget::normalizeAngle(int *angle)
    261 {
    262     while (*angle < 0)
    263         *angle += 360 * 16;
    264     while (*angle > 360 * 16)
    265         *angle -= 360 * 16;
    266 }
  • trunk/examples/opengl/hellogl/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545#include <QGLWidget>
     46
     47class QtLogo;
    4648
    4749//! [0]
     
    8183//! [3]
    8284private:
    83     GLuint makeObject();
    84     void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
    85               GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4);
    86     void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
    87     void normalizeAngle(int *angle);
    88 
    89     GLuint object;
     85    QtLogo *logo;
    9086    int xRot;
    9187    int yRot;
    9288    int zRot;
    9389    QPoint lastPos;
    94     QColor trolltechGreen;
    95     QColor trolltechPurple;
     90    QColor qtGreen;
     91    QColor qtPurple;
    9692};
    9793//! [3]
  • trunk/examples/opengl/hellogl/hellogl.pro

    r2 r561  
     1VPATH += ../shared
     2INCLUDEPATH += ../shared
     3
    14HEADERS       = glwidget.h \
    2                 window.h
     5                window.h \
     6                qtlogo.h
    37SOURCES       = glwidget.cpp \
    48                main.cpp \
    5                 window.cpp
     9                window.cpp \
     10                qtlogo.cpp
    611QT           += opengl
    712
     
    1116sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl
    1217INSTALLS += target sources
     18
     19symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/hellogl/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4141
    4242#include <QApplication>
     43#include <QDesktopWidget>
    4344
    4445#include "window.h"
     
    4849    QApplication app(argc, argv);
    4950    Window window;
    50     window.show();
     51    window.resize(window.sizeHint());
     52    int desktopArea = QApplication::desktop()->width() *
     53                     QApplication::desktop()->height();
     54    int widgetArea = window.width() * window.height();
     55    if (((float)widgetArea / (float)desktopArea) < 0.75f)
     56        window.show();
     57    else
     58        window.showMaximized();
    5159    return app.exec();
    5260}
  • trunk/examples/opengl/hellogl/window.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8989}
    9090//! [2]
     91
     92void Window::keyPressEvent(QKeyEvent *e)
     93{
     94    if (e->key() == Qt::Key_Escape)
     95        close();
     96    else
     97        QWidget::keyPressEvent(e);
     98}
  • trunk/examples/opengl/hellogl/window.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858    Window();
    5959
     60protected:
     61    void keyPressEvent(QKeyEvent *event);
     62
    6063private:
    6164    QSlider *createSlider();
  • trunk/examples/opengl/hellogl_es/bubble.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/bubble.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/cl_helper.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/hellogl_es.pro

    r2 r561  
    2121QT += opengl
    2222
    23 contains(QT_CONFIG,opengles1) {
    24         QMAKE_LIBS += "libGLES_CM.lib"
    25 }
    26 contains(QT_CONFIG,opengles1cl) {
    27         QMAKE_LIBS += "libGLES_CL.lib"
    28 }
    29 
    3023# install
    3124target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es
  • trunk/examples/opengl/hellogl_es/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/mainwindow.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es/mainwindow.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es2/bubble.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es2/bubble.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es2/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "glwidget.h"
    4343#include <QPainter>
     44#include <QPaintEngine>
    4445#include <math.h>
    4546
     
    4849
    4950const int bubbleNum = 8;
    50 
    51 inline void CrossProduct(qreal &xOut, qreal &yOut, qreal &zOut, qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2)
    52 {
    53    xOut = y1 * z2 - z1 * y2;
    54    yOut = z1 * x2 - x1 * z2;
    55    zOut = x1 * y2 - y1 * x2;
    56 }
    57 
    58 inline void Normalize(qreal &x, qreal &y, qreal &z)
    59 {
    60     qreal l = sqrt(x*x + y*y + z*z);
    61     x = x / l;
    62     y = y / l;
    63     z = z / l;
    64 }
    65 
    66 inline void IdentityMatrix(GLfloat *m)
    67 {
    68     m[0 * 4 + 0] = 1.0f;
    69     m[1 * 4 + 0] = 0.0f;
    70     m[2 * 4 + 0] = 0.0f;
    71     m[3 * 4 + 0] = 0.0f;
    72     m[0 * 4 + 1] = 0.0f;
    73     m[1 * 4 + 1] = 1.0f;
    74     m[2 * 4 + 1] = 0.0f;
    75     m[3 * 4 + 1] = 0.0f;
    76     m[0 * 4 + 2] = 0.0f;
    77     m[1 * 4 + 2] = 0.0f;
    78     m[2 * 4 + 2] = 1.0f;
    79     m[3 * 4 + 2] = 0.0f;
    80     m[0 * 4 + 3] = 0.0f;
    81     m[1 * 4 + 3] = 0.0f;
    82     m[2 * 4 + 3] = 0.0f;
    83     m[3 * 4 + 3] = 1.0f;
    84 }
    85 
    86 // Adjust a 4x4 matrix to apply a scale.
    87 inline void ScaleMatrix(GLfloat *m, GLfloat scalex, GLfloat scaley, GLfloat scalez)
    88 {
    89     m[0 * 4 + 0] *= scalex;
    90     m[0 * 4 + 1] *= scalex;
    91     m[0 * 4 + 2] *= scalex;
    92     m[0 * 4 + 3] *= scalex;
    93     m[1 * 4 + 0] *= scaley;
    94     m[1 * 4 + 1] *= scaley;
    95     m[1 * 4 + 2] *= scaley;
    96     m[1 * 4 + 3] *= scaley;
    97     m[2 * 4 + 0] *= scalez;
    98     m[2 * 4 + 1] *= scalez;
    99     m[2 * 4 + 2] *= scalez;
    100     m[2 * 4 + 3] *= scalez;
    101 }
    102 
    103 // Adjust a 4x4 matrix to apply a translation.
    104 inline void TranslateMatrix(GLfloat *m, GLfloat translatex, GLfloat translatey, GLfloat translatez)
    105 {
    106     m[3 * 4 + 0] += m[0 * 4 + 0] * translatex + m[1 * 4 + 0] * translatey + m[2 * 4 + 0] * translatez;
    107     m[3 * 4 + 1] += m[0 * 4 + 1] * translatex + m[1 * 4 + 1] * translatey + m[2 * 4 + 1] * translatez;
    108     m[3 * 4 + 2] += m[0 * 4 + 2] * translatex + m[1 * 4 + 2] * translatey + m[2 * 4 + 2] * translatez;
    109     m[3 * 4 + 3] += m[0 * 4 + 3] * translatex + m[1 * 4 + 3] * translatey + m[2 * 4 + 3] * translatez;
    110 }
    111 
    112 #ifndef M_PI
    113 #define M_PI 3.14159265358979323846
    114 #endif
    115 
    116 // Adjust a 4x4 matrix to apply a rotation.
    117 inline void RotateMatrix(GLfloat *m, GLfloat angle, GLfloat vx, GLfloat vy, GLfloat vz)
    118 {
    119     GLfloat len = sqrt(vx * vx + vy * vy + vz * vz);
    120     if (len != 0) {
    121         vx /= len;
    122         vy /= len;
    123         vz /= len;
    124     }
    125 
    126     GLfloat c, s, ic;
    127     c = cos(angle * M_PI / 180.0);
    128     s = sin(angle * M_PI / 180.0);
    129     ic = 1.0f - c;
    130 
    131     GLfloat rot[16];
    132     rot[0 * 4 + 0] = vx * vx * ic + c;
    133     rot[1 * 4 + 0] = vx * vy * ic - vz * s;
    134     rot[2 * 4 + 0] = vx * vz * ic + vy * s;
    135     rot[3 * 4 + 0] = 0.0f;
    136     rot[0 * 4 + 1] = vy * vx * ic + vz * s;
    137     rot[1 * 4 + 1] = vy * vy * ic + c;
    138     rot[2 * 4 + 1] = vy * vz * ic - vx * s;
    139     rot[3 * 4 + 1] = 0.0f;
    140     rot[0 * 4 + 2] = vx * vz * ic - vy * s;
    141     rot[1 * 4 + 2] = vy * vz * ic + vx * s;
    142     rot[2 * 4 + 2] = vz * vz * ic + c;
    143     rot[3 * 4 + 2] = 0.0f;
    144     rot[0 * 4 + 3] = 0.0f;
    145     rot[1 * 4 + 3] = 0.0f;
    146     rot[2 * 4 + 3] = 0.0f;
    147     rot[3 * 4 + 3] = 1.0f;
    148 
    149     GLfloat temp[16];
    150     for (int i = 0; i < 4; ++i) {
    151         for (int j = 0; j < 4; ++j) {
    152             temp[j * 4 + i] = 0.0f;
    153             for (int k = 0; k < 4; ++k) {
    154                 temp[j * 4 + i] += m[k * 4 + i] * rot[j * 4 + k];
    155             }
    156         }
    157     }
    158 
    159     qMemCopy(m, temp, sizeof(temp));
    160 }
    16151
    16252GLWidget::GLWidget(QWidget *parent)
     
    16454{
    16555    qtLogo = true;
    166     createdVertices = 0;
    167     createdNormals = 0;
    168     m_vertexNumber = 0;
    16956    frames = 0;
    17057    setAttribute(Qt::WA_PaintOnScreen);
     
    17966GLWidget::~GLWidget()
    18067{
    181   if (createdVertices)
    182       delete[] createdVertices;
    183   if (createdNormals)
    184       delete[] createdNormals;
    18568}
    18669
     
    21093void GLWidget::paintQtLogo()
    21194{
    212     glDisable(GL_TEXTURE_2D);
    213     glVertexAttribPointer(vertexAttr1, 3, GL_FLOAT, GL_FALSE, 0, createdVertices);
    214     glEnableVertexAttribArray(vertexAttr1);
    215     glVertexAttribPointer(normalAttr1, 3, GL_FLOAT, GL_FALSE, 0, createdNormals);
    216     glEnableVertexAttribArray(normalAttr1);
    217     glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3);
    218     glDisableVertexAttribArray(normalAttr1);
    219     glDisableVertexAttribArray(vertexAttr1);
     95    program1.enableAttributeArray(normalAttr1);
     96    program1.enableAttributeArray(vertexAttr1);
     97    program1.setAttributeArray(vertexAttr1, vertices.constData());
     98    program1.setAttributeArray(normalAttr1, normals.constData());
     99    glDrawArrays(GL_TRIANGLES, 0, vertices.size());
     100    program1.disableAttributeArray(normalAttr1);
     101    program1.disableAttributeArray(vertexAttr1);
    220102}
    221103
    222104void GLWidget::paintTexturedCube()
    223105{
    224     glEnable(GL_TEXTURE_2D);
    225106    glBindTexture(GL_TEXTURE_2D, m_uiTexture);
    226107    GLfloat afVertices[] = {
     
    240121        0.5, -0.5, 0.5,  0.5,  -0.5, -0.5, -0.5,  -0.5, 0.5
    241122    };
    242     glVertexAttribPointer(vertexAttr2, 3, GL_FLOAT, GL_FALSE, 0, afVertices);
    243     glEnableVertexAttribArray(vertexAttr2);
     123    program2.setAttributeArray(vertexAttr2, afVertices, 3);
    244124
    245125    GLfloat afTexCoord[] = {
     
    259139        0.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f
    260140    };
    261     glVertexAttribPointer(texCoordAttr2, 2, GL_FLOAT, GL_FALSE, 0, afTexCoord);
    262     glEnableVertexAttribArray(texCoordAttr2);
     141    program2.setAttributeArray(texCoordAttr2, afTexCoord, 2);
    263142
    264143    GLfloat afNormals[] = {
     
    279158        0,1,0, 0,1,0, 0,1,0
    280159    };
    281     glVertexAttribPointer(normalAttr2, 3, GL_FLOAT, GL_FALSE, 0, afNormals);
    282     glEnableVertexAttribArray(normalAttr2);
    283 
    284     glUniform1i(textureUniform2, 0);    // use texture unit 0
     160    program2.setAttributeArray(normalAttr2, afNormals, 3);
     161
     162    program2.setUniformValue(textureUniform2, 0);    // use texture unit 0
     163
     164    program2.enableAttributeArray(vertexAttr2);
     165    program2.enableAttributeArray(normalAttr2);
     166    program2.enableAttributeArray(texCoordAttr2);
    285167
    286168    glDrawArrays(GL_TRIANGLES, 0, 36);
    287169
    288     glDisableVertexAttribArray(vertexAttr2);
    289     glDisableVertexAttribArray(normalAttr2);
    290     glDisableVertexAttribArray(texCoordAttr2);
    291 }
    292 
    293 static void reportCompileErrors(GLuint shader, const char *src)
    294 {
    295     GLint value = 0;
    296     glGetShaderiv(shader, GL_COMPILE_STATUS, &value);
    297     bool compiled = (value != 0);
    298     value = 0;
    299     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &value);
    300     if (!compiled && value > 1) {
    301         char *log = new char [value];
    302         GLint len;
    303         glGetShaderInfoLog(shader, value, &len, log);
    304         qWarning("%s\n", log);
    305         qWarning("when compiling:\n%s\n", src);
    306         delete [] log;
    307     }
    308 }
    309 
    310 static void reportLinkErrors(GLuint program, const char *vsrc, const char *fsrc)
    311 {
    312     GLint value = 0;
    313     glGetProgramiv(program, GL_LINK_STATUS, &value);
    314     bool linked = (value != 0);
    315     value = 0;
    316     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value);
    317     if (!linked && value > 1) {
    318         char *log = new char [value];
    319         GLint len;
    320         glGetProgramInfoLog(program, value, &len, log);
    321         qWarning("%s\n", log);
    322         qWarning("when linking:\n%s\nwith:\n%s\n", vsrc, fsrc);
    323         delete [] log;
    324     }
     170    program2.disableAttributeArray(vertexAttr2);
     171    program2.disableAttributeArray(normalAttr2);
     172    program2.disableAttributeArray(texCoordAttr2);
    325173}
    326174
     
    329177    glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
    330178
    331     glEnable(GL_TEXTURE_2D);
    332179    glGenTextures(1, &m_uiTexture);
    333180    m_uiTexture = bindTexture(QImage(":/qt.png"));
    334181
    335     GLuint vshader1 = glCreateShader(GL_VERTEX_SHADER);
    336     const char *vsrc1[1] = {
     182    QGLShader *vshader1 = new QGLShader(QGLShader::Vertex, this);
     183    const char *vsrc1 =
    337184        "attribute highp vec4 vertex;\n"
    338185        "attribute mediump vec3 normal;\n"
     
    347194        "    color = clamp(color, 0.0, 1.0);\n"
    348195        "    gl_Position = matrix * vertex;\n"
    349         "}\n"
    350     };
    351     glShaderSource(vshader1, 1, vsrc1, 0);
    352     glCompileShader(vshader1);
    353     reportCompileErrors(vshader1, vsrc1[0]);
    354 
    355     GLuint fshader1 = glCreateShader(GL_FRAGMENT_SHADER);
    356     const char *fsrc1[1] = {
     196        "}\n";
     197    vshader1->compileSourceCode(vsrc1);
     198
     199    QGLShader *fshader1 = new QGLShader(QGLShader::Fragment, this);
     200    const char *fsrc1 =
    357201        "varying mediump vec4 color;\n"
    358202        "void main(void)\n"
    359203        "{\n"
    360204        "    gl_FragColor = color;\n"
    361         "}\n"
    362     };
    363     glShaderSource(fshader1, 1, fsrc1, 0);
    364     glCompileShader(fshader1);
    365     reportCompileErrors(fshader1, fsrc1[0]);
    366 
    367     program1 = glCreateProgram();
    368     glAttachShader(program1, vshader1);
    369     glAttachShader(program1, fshader1);
    370     glLinkProgram(program1);
    371     reportLinkErrors(program1, vsrc1[0], fsrc1[0]);
    372 
    373     vertexAttr1 = glGetAttribLocation(program1, "vertex");
    374     normalAttr1 = glGetAttribLocation(program1, "normal");
    375     matrixUniform1 = glGetUniformLocation(program1, "matrix");
    376 
    377     GLuint vshader2 = glCreateShader(GL_VERTEX_SHADER);
    378     const char *vsrc2[1] = {
     205        "}\n";
     206    fshader1->compileSourceCode(fsrc1);
     207
     208    program1.addShader(vshader1);
     209    program1.addShader(fshader1);
     210    program1.link();
     211
     212    vertexAttr1 = program1.attributeLocation("vertex");
     213    normalAttr1 = program1.attributeLocation("normal");
     214    matrixUniform1 = program1.uniformLocation("matrix");
     215
     216    QGLShader *vshader2 = new QGLShader(QGLShader::Vertex);
     217    const char *vsrc2 =
    379218        "attribute highp vec4 vertex;\n"
    380219        "attribute highp vec4 texCoord;\n"
     
    389228        "    gl_Position = matrix * vertex;\n"
    390229        "    texc = texCoord;\n"
    391         "}\n"
    392     };
    393     glShaderSource(vshader2, 1, vsrc2, 0);
    394     glCompileShader(vshader2);
    395     reportCompileErrors(vshader2, vsrc2[0]);
    396 
    397     GLuint fshader2 = glCreateShader(GL_FRAGMENT_SHADER);
    398     const char *fsrc2[1] = {
     230        "}\n";
     231    vshader2->compileSourceCode(vsrc2);
     232
     233    QGLShader *fshader2 = new QGLShader(QGLShader::Fragment);
     234    const char *fsrc2 =
    399235        "varying highp vec4 texc;\n"
    400236        "uniform sampler2D tex;\n"
     
    405241        "    color = color * 0.2 + color * 0.8 * angle;\n"
    406242        "    gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n"
    407         "}\n"
    408     };
    409     glShaderSource(fshader2, 1, fsrc2, 0);
    410     glCompileShader(fshader2);
    411     reportCompileErrors(fshader2, fsrc2[0]);
    412 
    413     program2 = glCreateProgram();
    414     glAttachShader(program2, vshader2);
    415     glAttachShader(program2, fshader2);
    416     glLinkProgram(program2);
    417     reportLinkErrors(program2, vsrc2[0], fsrc2[0]);
    418 
    419     vertexAttr2 = glGetAttribLocation(program2, "vertex");
    420     normalAttr2 = glGetAttribLocation(program2, "normal");
    421     texCoordAttr2 = glGetAttribLocation(program2, "texCoord");
    422     matrixUniform2 = glGetUniformLocation(program2, "matrix");
    423     textureUniform2 = glGetUniformLocation(program2, "tex");
     243        "}\n";
     244    fshader2->compileSourceCode(fsrc2);
     245
     246    program2.addShader(vshader2);
     247    program2.addShader(fshader2);
     248    program2.link();
     249
     250    vertexAttr2 = program2.attributeLocation("vertex");
     251    normalAttr2 = program2.attributeLocation("normal");
     252    texCoordAttr2 = program2.attributeLocation("texCoord");
     253    matrixUniform2 = program2.uniformLocation("matrix");
     254    textureUniform2 = program2.uniformLocation("tex");
    424255
    425256    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
     
    439270    painter.begin(this);
    440271
     272    painter.beginNativePainting();
     273
    441274    glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
    442275    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    443     glEnable(GL_TEXTURE_2D);
    444276
    445277    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
     
    451283    glEnable(GL_DEPTH_TEST);
    452284
    453     GLfloat modelview[16];
    454     IdentityMatrix(modelview);
    455     RotateMatrix(modelview, m_fAngle, 0.0, 1.0, 0.0);
    456     RotateMatrix(modelview, m_fAngle, 1.0, 0.0, 0.0);
    457     RotateMatrix(modelview, m_fAngle, 0.0, 0.0, 1.0);
    458     ScaleMatrix(modelview, m_fScale, m_fScale, m_fScale);
    459     TranslateMatrix(modelview, 0, -0.2, 0);
     285    QMatrix4x4 modelview;
     286    modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
     287    modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
     288    modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
     289    modelview.scale(m_fScale);
     290    modelview.translate(0.0f, -0.2f, 0.0f);
    460291
    461292    if (qtLogo) {
    462         glUseProgram(program1);
    463         glUniformMatrix4fv(matrixUniform1, 1, GL_FALSE, modelview);
     293        program1.bind();
     294        program1.setUniformValue(matrixUniform1, modelview);
    464295        paintQtLogo();
    465         glUseProgram(0);
     296        program1.release();
    466297    } else {
    467         glUseProgram(program2);
    468         glUniformMatrix4fv(matrixUniform2, 1, GL_FALSE, modelview);
     298        program2.bind();
     299        program1.setUniformValue(matrixUniform2, modelview);
    469300        paintTexturedCube();
    470         glUseProgram(0);
     301        program2.release();
    471302    }
    472303
    473304    glDisable(GL_DEPTH_TEST);
    474305    glDisable(GL_CULL_FACE);
     306
     307    painter.endNativePainting();
    475308
    476309    if (m_showBubbles)
     
    564397    }
    565398
    566     m_vertexNumber = vertices.size();
    567     createdVertices = new GLfloat[m_vertexNumber];
    568     createdNormals = new GLfloat[m_vertexNumber];
    569     for (int i = 0;i < m_vertexNumber;i++) {
    570       createdVertices[i] = vertices.at(i) * 2;
    571       createdNormals[i] = normals.at(i);
    572     }
    573     vertices.clear();
    574     normals.clear();
     399    for (int i = 0;i < vertices.size();i++)
     400        vertices[i] *= 2.0f;
    575401}
    576402
    577403void GLWidget::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
    578404{
    579     qreal nx, ny, nz;
    580 
    581     vertices << x1 << y1 << -0.05f;
    582     vertices << x2 << y2 << -0.05f;
    583     vertices << x4 << y4 << -0.05f;
    584 
    585     vertices << x3 << y3 << -0.05f;
    586     vertices << x4 << y4 << -0.05f;
    587     vertices << x2 << y2 << -0.05f;
    588 
    589     CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0, x4 - x1, y4 - y1, 0);
    590     Normalize(nx, ny, nz);
    591 
    592     normals << nx << ny << nz;
    593     normals << nx << ny << nz;
    594     normals << nx << ny << nz;
    595 
    596     normals << nx << ny << nz;
    597     normals << nx << ny << nz;
    598     normals << nx << ny << nz;
    599 
    600     vertices << x4 << y4 << 0.05f;
    601     vertices << x2 << y2 << 0.05f;
    602     vertices << x1 << y1 << 0.05f;
    603 
    604     vertices << x2 << y2 << 0.05f;
    605     vertices << x4 << y4 << 0.05f;
    606     vertices << x3 << y3 << 0.05f;
    607 
    608     CrossProduct(nx, ny, nz, x2 - x4, y2 - y4, 0, x1 - x4, y1 - y4, 0);
    609     Normalize(nx, ny, nz);
    610 
    611     normals << nx << ny << nz;
    612     normals << nx << ny << nz;
    613     normals << nx << ny << nz;
    614 
    615     normals << nx << ny << nz;
    616     normals << nx << ny << nz;
    617     normals << nx << ny << nz;
     405    vertices << QVector3D(x1, y1, -0.05f);
     406    vertices << QVector3D(x2, y2, -0.05f);
     407    vertices << QVector3D(x4, y4, -0.05f);
     408
     409    vertices << QVector3D(x3, y3, -0.05f);
     410    vertices << QVector3D(x4, y4, -0.05f);
     411    vertices << QVector3D(x2, y2, -0.05f);
     412
     413    QVector3D n = QVector3D::normal
     414        (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f));
     415
     416    normals << n;
     417    normals << n;
     418    normals << n;
     419
     420    normals << n;
     421    normals << n;
     422    normals << n;
     423
     424    vertices << QVector3D(x4, y4, 0.05f);
     425    vertices << QVector3D(x2, y2, 0.05f);
     426    vertices << QVector3D(x1, y1, 0.05f);
     427
     428    vertices << QVector3D(x2, y2, 0.05f);
     429    vertices << QVector3D(x4, y4, 0.05f);
     430    vertices << QVector3D(x3, y3, 0.05f);
     431
     432    n = QVector3D::normal
     433        (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f));
     434
     435    normals << n;
     436    normals << n;
     437    normals << n;
     438
     439    normals << n;
     440    normals << n;
     441    normals << n;
    618442}
    619443
    620444void GLWidget::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
    621445{
    622     qreal nx, ny, nz;
    623 
    624     vertices << x1 << y1 << +0.05f;
    625     vertices << x2 << y2 << +0.05f;
    626     vertices << x1 << y1 << -0.05f;
    627 
    628     vertices << x2 << y2 << -0.05f;
    629     vertices << x1 << y1 << -0.05f;
    630     vertices << x2 << y2 << +0.05f;
    631 
    632     CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0.0f, 0.0f, 0.0f, -0.1f);
    633     Normalize(nx, ny, nz);
    634 
    635     normals << nx << ny << nz;
    636     normals << nx << ny << nz;
    637     normals << nx << ny << nz;
    638 
    639     normals << nx << ny << nz;
    640     normals << nx << ny << nz;
    641     normals << nx << ny << nz;
    642 }
     446    vertices << QVector3D(x1, y1, +0.05f);
     447    vertices << QVector3D(x2, y2, +0.05f);
     448    vertices << QVector3D(x1, y1, -0.05f);
     449
     450    vertices << QVector3D(x2, y2, -0.05f);
     451    vertices << QVector3D(x1, y1, -0.05f);
     452    vertices << QVector3D(x2, y2, +0.05f);
     453
     454    QVector3D n = QVector3D::normal
     455        (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f));
     456
     457    normals << n;
     458    normals << n;
     459    normals << n;
     460
     461    normals << n;
     462    normals << n;
     463    normals << n;
     464}
  • trunk/examples/opengl/hellogl_es2/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545#include <QGLWidget>
     46#include <QtGui/qvector3d.h>
     47#include <QtGui/qmatrix4x4.h>
     48#include <QtOpenGL/qglshaderprogram.h>
    4649#include <QTime>
     50#include <QVector>
    4751
    4852class Bubble;
     
    7276    void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
    7377    void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
    74     QList<qreal> vertices;
    75     QList<qreal> normals;
    76     GLfloat *createdVertices;
    77     GLfloat *createdNormals;
    78     int m_vertexNumber;
     78    QVector<QVector3D> vertices;
     79    QVector<QVector3D> normals;
    7980    bool qtLogo;
    8081    QList<Bubble*> bubbles;
    8182    int frames;
    8283    QTime time;
    83     GLuint program1;
    84     GLuint program2;
    85     GLuint vertexAttr1;
    86     GLuint normalAttr1;
    87     GLuint matrixUniform1;
    88     GLuint vertexAttr2;
    89     GLuint normalAttr2;
    90     GLuint texCoordAttr2;
    91     GLuint matrixUniform2;
    92     GLuint textureUniform2;
     84    QGLShaderProgram program1;
     85    QGLShaderProgram program2;
     86    int vertexAttr1;
     87    int normalAttr1;
     88    int matrixUniform1;
     89    int vertexAttr2;
     90    int normalAttr2;
     91    int texCoordAttr2;
     92    int matrixUniform2;
     93    int textureUniform2;
    9394};
    9495#endif
  • trunk/examples/opengl/hellogl_es2/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es2/mainwindow.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/hellogl_es2/mainwindow.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/opengl.pro

    r2 r561  
    66    } else {
    77        SUBDIRS   = hellogl_es
     8    }
     9    !contains(QT_CONFIG, opengles1cl) {
     10        SUBDIRS += textures
     11    }
     12    contains(QT_CONFIG, opengles1) {
     13        SUBDIRS += hellogl
    814    }
    915} else {
     
    2834sources.path = $$[QT_INSTALL_EXAMPLES]/opengl
    2935INSTALLS += target sources
     36
     37symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/overpainting/bubble.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/overpainting/bubble.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/overpainting/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4747
    4848#include "bubble.h"
     49#include "qtlogo.h"
    4950#include "glwidget.h"
    5051
     
    6061    qsrand(midnight.secsTo(QTime::currentTime()));
    6162
    62     object = 0;
     63    logo = 0;
    6364    xRot = 0;
    6465    yRot = 0;
    6566    zRot = 0;
    6667
    67     trolltechGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
    68     trolltechPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
     68    qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
     69    qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
    6970
    7071    animationTimer.setSingleShot(false);
     
    8182GLWidget::~GLWidget()
    8283{
    83     makeCurrent();
    84     glDeleteLists(object, 1);
    8584}
    8685//! [1]
    8786
     87static void qNormalizeAngle(int &angle)
     88{
     89    while (angle < 0)
     90        angle += 360 * 16;
     91    while (angle > 360 * 16)
     92        angle -= 360 * 16;
     93}
     94
    8895void GLWidget::setXRotation(int angle)
    8996{
    90     normalizeAngle(&angle);
     97    qNormalizeAngle(angle);
    9198    if (angle != xRot)
    9299        xRot = angle;
     
    95102void GLWidget::setYRotation(int angle)
    96103{
    97     normalizeAngle(&angle);
     104    qNormalizeAngle(angle);
    98105    if (angle != yRot)
    99106        yRot = angle;
     
    102109void GLWidget::setZRotation(int angle)
    103110{
    104     normalizeAngle(&angle);
     111    qNormalizeAngle(angle);
    105112    if (angle != zRot)
    106113        zRot = angle;
     
    110117void GLWidget::initializeGL()
    111118{
    112     object = makeObject();
     119    glEnable(GL_MULTISAMPLE);
     120
     121    logo = new QtLogo(this);
     122    logo->setColor(qtGreen.dark());
    113123}
    114124//! [2]
     
    143153
    144154//! [6]
    145     qglClearColor(trolltechPurple.dark());
     155    qglClearColor(qtPurple.dark());
    146156    glShadeModel(GL_SMOOTH);
    147157    glEnable(GL_DEPTH_TEST);
     
    159169    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    160170    glLoadIdentity();
    161     glTranslated(0.0, 0.0, -10.0);
    162     glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
    163     glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
    164     glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
    165     glCallList(object);
     171    glTranslatef(0.0, 0.0, -10.0);
     172    glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
     173    glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
     174    glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
     175
     176    logo->draw();
    166177//! [7]
    167178
    168179//! [8]
     180    glShadeModel(GL_FLAT);
     181    glDisable(GL_CULL_FACE);
     182    glDisable(GL_DEPTH_TEST);
     183    glDisable(GL_LIGHTING);
     184
    169185    glMatrixMode(GL_MODELVIEW);
    170186    glPopMatrix();
     
    203219}
    204220
    205 GLuint GLWidget::makeObject()
    206 {
    207     GLuint list = glGenLists(1);
    208     glNewList(list, GL_COMPILE);
    209 
    210     glEnable(GL_NORMALIZE);
    211     glBegin(GL_QUADS);
    212 
    213     static GLfloat logoDiffuseColor[4] = {trolltechGreen.red()/255.0,
    214                                           trolltechGreen.green()/255.0,
    215                                           trolltechGreen.blue()/255.0, 1.0};
    216     glMaterialfv(GL_FRONT, GL_DIFFUSE, logoDiffuseColor);
    217 
    218     GLdouble x1 = +0.06;
    219     GLdouble y1 = -0.14;
    220     GLdouble x2 = +0.14;
    221     GLdouble y2 = -0.06;
    222     GLdouble x3 = +0.08;
    223     GLdouble y3 = +0.00;
    224     GLdouble x4 = +0.30;
    225     GLdouble y4 = +0.22;
    226 
    227     quad(x1, y1, x2, y2, y2, x2, y1, x1);
    228     quad(x3, y3, x4, y4, y4, x4, y3, x3);
    229 
    230     extrude(x1, y1, x2, y2);
    231     extrude(x2, y2, y2, x2);
    232     extrude(y2, x2, y1, x1);
    233     extrude(y1, x1, x1, y1);
    234     extrude(x3, y3, x4, y4);
    235     extrude(x4, y4, y4, x4);
    236     extrude(y4, x4, y3, x3);
    237 
    238     const double Pi = 3.14159265358979323846;
    239     const int NumSectors = 200;
    240 
    241     for (int i = 0; i < NumSectors; ++i) {
    242         double angle1 = (i * 2 * Pi) / NumSectors;
    243         GLdouble x5 = 0.30 * sin(angle1);
    244         GLdouble y5 = 0.30 * cos(angle1);
    245         GLdouble x6 = 0.20 * sin(angle1);
    246         GLdouble y6 = 0.20 * cos(angle1);
    247 
    248         double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
    249         GLdouble x7 = 0.20 * sin(angle2);
    250         GLdouble y7 = 0.20 * cos(angle2);
    251         GLdouble x8 = 0.30 * sin(angle2);
    252         GLdouble y8 = 0.30 * cos(angle2);
    253 
    254         quad(x5, y5, x6, y6, x7, y7, x8, y8);
    255 
    256         extrude(x6, y6, x7, y7);
    257         extrude(x8, y8, x5, y5);
    258     }
    259 
    260     glEnd();
    261 
    262     glEndList();
    263     return list;
    264 }
    265 
    266 void GLWidget::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
    267                     GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
    268 {
    269     glNormal3d(0.0, 0.0, -1.0);
    270     glVertex3d(x1, y1, -0.05);
    271     glVertex3d(x2, y2, -0.05);
    272     glVertex3d(x3, y3, -0.05);
    273     glVertex3d(x4, y4, -0.05);
    274 
    275     glNormal3d(0.0, 0.0, 1.0);
    276     glVertex3d(x4, y4, +0.05);
    277     glVertex3d(x3, y3, +0.05);
    278     glVertex3d(x2, y2, +0.05);
    279     glVertex3d(x1, y1, +0.05);
    280 }
    281 
    282 void GLWidget::extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
    283 {
    284     qglColor(trolltechGreen.dark(250 + int(100 * x1)));
    285 
    286     glNormal3d((x1 + x2)/2.0, (y1 + y2)/2.0, 0.0);
    287     glVertex3d(x1, y1, +0.05);
    288     glVertex3d(x2, y2, +0.05);
    289     glVertex3d(x2, y2, -0.05);
    290     glVertex3d(x1, y1, -0.05);
    291 }
    292 
    293 void GLWidget::normalizeAngle(int *angle)
    294 {
    295     while (*angle < 0)
    296         *angle += 360 * 16;
    297     while (*angle > 360 * 16)
    298         *angle -= 360 * 16;
    299 }
    300 
    301221void GLWidget::createBubbles(int number)
    302222{
     
    333253    glMatrixMode(GL_PROJECTION);
    334254    glLoadIdentity();
    335     glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
     255#ifdef QT_OPENGL_ES
     256    glOrthof(-0.5, +0.5, -0.5, 0.5, 4.0, 15.0);
     257#else
     258    glOrtho(-0.5, +0.5, -0.5, 0.5, 4.0, 15.0);
     259#endif
    336260    glMatrixMode(GL_MODELVIEW);
    337261}
  • trunk/examples/opengl/overpainting/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5151
    5252class Bubble;
     53class QtLogo;
    5354QT_BEGIN_NAMESPACE
    5455class QPaintEvent;
     
    8990
    9091private:
    91     GLuint makeObject();
    9292    void createBubbles(int number);
    9393    void drawInstructions(QPainter *painter);
    9494//! [1]
    95     void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
    96     void normalizeAngle(int *angle);
    97     void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
    98               GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4);
    9995    void setupViewport(int width, int height);
     96
     97    QColor qtGreen;
     98    QColor qtPurple;
    10099
    101100    GLuint object;
     
    104103    int zRot;
    105104    QPoint lastPos;
    106     QColor trolltechGreen;
    107     QColor trolltechPurple;
    108105//! [4]
     106    QtLogo *logo;
    109107    QList<Bubble*> bubbles;
    110108    QTimer animationTimer;
     109//! [4]
    111110};
    112 //! [4]
    113111
    114112#endif
  • trunk/examples/opengl/overpainting/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/overpainting/overpainting.pro

    r2 r561  
    1 QT          += opengl
     1VPATH += ../shared
     2INCLUDEPATH += ../shared
    23
    3 HEADERS     = bubble.h \
    4               glwidget.h
    5 SOURCES     = bubble.cpp \
    6               glwidget.cpp \
    7               main.cpp
     4QT += opengl
     5HEADERS = bubble.h \
     6    glwidget.h \
     7    qtlogo.h
     8SOURCES = bubble.cpp \
     9    glwidget.cpp \
     10    main.cpp \
     11    qtlogo.cpp
    812
    913# install
    1014target.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting
    11 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS overpainting.pro
     15sources.files = $$SOURCES \
     16    $$HEADERS \
     17    $$RESOURCES \
     18    $$FORMS \
     19    overpainting.pro
    1220sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting
    13 INSTALLS += target sources
     21INSTALLS += target \
     22    sources
     23symbian:include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/pbuffers/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4141
    4242#include "glwidget.h"
    43 #include <QtGui/QImage>
    44 
    4543#include <math.h>
    4644
    47 static GLint cubeArray[][3] = {
    48     {0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0},
    49     {0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1},
    50     {0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1},
    51     {0, 1, 0}, {0, 1, 1}, {1, 1, 1}, {1, 1, 0},
    52     {0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1},
    53     {1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}
     45#include "cube.h"
     46
     47#include <QGLPixelBuffer>
     48
     49#ifndef GL_MULTISAMPLE
     50#define GL_MULTISAMPLE  0x809D
     51#endif
     52
     53static GLfloat colorArray[][4] = {
     54    {0.243f, 0.423f, 0.125f, 1.0f},
     55    {0.176f, 0.31f, 0.09f, 1.0f},
     56    {0.4f, 0.69f, 0.212f, 1.0f},
     57    {0.317f, 0.553f, 0.161f, 1.0f}
    5458};
    5559
    56 static GLint cubeTextureArray[][2] = {
    57     {0, 0}, {1, 0}, {1, 1}, {0, 1},
    58     {0, 0}, {0, 1}, {1, 1}, {1, 0},
    59     {0, 0}, {1, 0}, {1, 1}, {0, 1},
    60     {1, 0}, {0, 0}, {0, 1}, {1, 1},
    61     {0, 0}, {1, 0}, {1, 1}, {0, 1},
    62     {1, 0}, {0, 0}, {0, 1}, {1, 1}
    63 };
    64 
    65 static GLint faceArray[][2] = {
    66     {1, -1}, {1, 1}, {-1, 1}, {-1, -1}
    67 };
    68 
    69 static GLubyte colorArray[][4] = {
    70     {102, 176, 54, 255},
    71     {81, 141, 41, 255},
    72     {62, 108, 32, 255},
    73     {45, 79, 23, 255}
    74 };
    75 
    7660GLWidget::GLWidget(QWidget *parent)
    77   : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
     61    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
     62    , geom(0)
     63    , cube(0)
    7864{
    7965    // create the pbuffer
    8066    pbuffer = new QGLPixelBuffer(QSize(512, 512), format(), this);
    81     timerId = startTimer(20);
    8267    setWindowTitle(tr("OpenGL pbuffers"));
     68    initializeGeometry();
    8369}
    8470
     
    8773    pbuffer->releaseFromDynamicTexture();
    8874    glDeleteTextures(1, &dynamicTexture);
    89     glDeleteLists(pbufferList, 1);
    9075    delete pbuffer;
     76
     77    qDeleteAll(cubes);
     78    qDeleteAll(tiles);
     79    delete cube;
    9180}
    9281
    9382void GLWidget::initializeGL()
    9483{
    95     glMatrixMode(GL_MODELVIEW);
    96 
     84    initCommon();
     85    glShadeModel(GL_SMOOTH);
     86    glEnable(GL_LIGHTING);
     87    glEnable(GL_LIGHT0);
     88    static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
     89    glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
     90    initPbuffer();
     91    cube->startAnimation();
     92    connect(cube, SIGNAL(changed()), this, SLOT(update()));
     93    for (int i = 0; i < 3; ++i)
     94    {
     95        cubes[i]->startAnimation();
     96        connect(cubes[i], SIGNAL(changed()), this, SLOT(update()));
     97    }
     98}
     99
     100void GLWidget::paintGL()
     101{
     102    pbuffer->makeCurrent();
     103    drawPbuffer();
     104    // On direct render platforms, drawing onto the pbuffer context above
     105    // automatically updates the dynamic texture.  For cases where rendering
     106    // directly to a texture is not supported, explicitly copy.
     107    if (!hasDynamicTextureUpdate)
     108        pbuffer->updateDynamicTexture(dynamicTexture);
     109    makeCurrent();
     110
     111    // Use the pbuffer as a texture to render the scene
     112    glBindTexture(GL_TEXTURE_2D, dynamicTexture);
     113
     114    // set up to render the scene
     115    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     116    glLoadIdentity();
     117    glTranslatef(0.0f, 0.0f, -10.0f);
     118
     119    // draw the background
     120    glPushMatrix();
     121    glScalef(aspect, 1.0f, 1.0f);
     122    for (int i = 0; i < tiles.count(); ++i)
     123        tiles[i]->draw();
     124    glPopMatrix();
     125
     126    // draw the bouncing cubes
     127    for (int i = 0; i < cubes.count(); ++i)
     128        cubes[i]->draw();
     129}
     130
     131void GLWidget::initializeGeometry()
     132{
     133    geom = new Geometry();
     134    CubeBuilder cBuilder(geom, 0.5);
     135    cBuilder.setColor(QColor(255, 255, 255, 212));
     136    // build the 3 bouncing, spinning cubes
     137    for (int i = 0; i < 3; ++i)
     138        cubes.append(cBuilder.newCube(QVector3D((float)(i-1), -1.5f, 5 - i)));
     139
     140    // build the spinning cube which goes in the dynamic texture
     141    cube = cBuilder.newCube();
     142    cube->removeBounce();
     143
     144    // build the background tiles
     145    TileBuilder tBuilder(geom);
     146    tBuilder.setColor(QColor(Qt::white));
     147    for (int c = -2; c <= +2; ++c)
     148        for (int r = -2; r <= +2; ++r)
     149            tiles.append(tBuilder.newTile(QVector3D(c, r, 0)));
     150
     151    // graded backdrop for the pbuffer scene
     152    TileBuilder bBuilder(geom, 0.0f, 2.0f);
     153    bBuilder.setColor(QColor(102, 176, 54, 210));
     154    backdrop = bBuilder.newTile(QVector3D(0.0f, 0.0f, -1.5f));
     155    backdrop->setColors(colorArray);
     156}
     157
     158void GLWidget::initCommon()
     159{
     160    qglClearColor(QColor(Qt::darkGray));
     161
     162    glEnable(GL_DEPTH_TEST);
    97163    glEnable(GL_CULL_FACE);
    98     initCommon();
    99     initPbuffer();
    100 
    101     for (int i = 0; i < 3; ++i) {
    102         yOffs[i] = 0.0f;
    103         xInc[i] = 0.005f;
    104         rot[i] = 0.0f;
    105     }
    106     xOffs[0]= 0.0f;
    107     xOffs[1]= 0.5f;
    108     xOffs[2]= 1.0f;
    109 
    110     cubeTexture = bindTexture(QImage(":res/cubelogo.png"));
    111 }
    112 
    113 void GLWidget::resizeGL(int w, int h)
    114 {
    115     glViewport(0, 0, w, h);
     164    glEnable(GL_MULTISAMPLE);
     165
     166    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     167    glEnable(GL_BLEND);
     168
     169    glEnable(GL_TEXTURE_2D);
     170
     171    geom->loadArrays();
     172}
     173
     174void GLWidget::perspectiveProjection()
     175{
    116176    glMatrixMode(GL_PROJECTION);
    117177    glLoadIdentity();
    118     float aspect = w/(float)(h ? h : 1);
    119     glFrustum(-aspect, aspect, -1, 1, 10, 100);
    120     glTranslatef(-0.5f, -0.5f, -0.5f);
    121     glTranslatef(0.0f, 0.0f, -15.0f);
    122 }
    123 
    124 void GLWidget::paintGL()
    125 {
    126     // draw a spinning cube into the pbuffer..
    127     pbuffer->makeCurrent();
    128     glBindTexture(GL_TEXTURE_2D, cubeTexture);
    129     glCallList(pbufferList);
    130     glFlush();
    131 
    132     // rendering directly to a texture is not supported on X11 and
    133     // some Windows implementations, unfortunately
    134     if (!hasDynamicTextureUpdate)
    135         pbuffer->updateDynamicTexture(dynamicTexture);
    136 
    137     // ..and use the pbuffer contents as a texture when rendering the
    138     // background and the bouncing cubes
    139     makeCurrent();
    140     glBindTexture(GL_TEXTURE_2D, dynamicTexture);
    141     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    142 
    143     // draw the background
     178#ifdef QT_OPENGL_ES
     179    glFrustumf(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
     180#else
     181    glFrustum(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
     182#endif
    144183    glMatrixMode(GL_MODELVIEW);
    145     glPushMatrix();
    146     glLoadIdentity();
    147     glMatrixMode(GL_PROJECTION);
    148     glPushMatrix();
    149     glLoadIdentity();
    150 
    151     glVertexPointer(2, GL_INT, 0, faceArray);
    152     glTranslatef(-1.2f, -0.8f, 0.0f);
    153     glScalef(0.2f, 0.2f, 0.2f);
    154     for (int y = 0; y < 5; ++y) {
    155         for (int x = 0; x < 5; ++x) {
    156             glTranslatef(2.0f, 0, 0);
    157             glColor4f(0.8, 0.8, 0.8, 1.0);
    158             glDrawArrays(GL_QUADS, 0, 4);
    159         }
    160         glTranslatef(-10.0f, 2.0f, 0);
    161     }
    162     glVertexPointer(3, GL_INT, 0, cubeArray);
    163 
    164     glPopMatrix();
    165     glMatrixMode(GL_MODELVIEW);
    166     glPopMatrix();
    167 
    168     // draw the bouncing cubes
    169     drawCube(0, 0.0f, 1.5f, 2.5f, 1.5f);
    170     drawCube(1, 1.0f, 2.0f, 2.5f, 2.0f);
    171     drawCube(2, 2.0f, 3.5f, 2.5f, 2.5f);
    172 }
    173 
    174 void GLWidget::drawCube(int i, GLfloat z, GLfloat rotation, GLfloat jmp, GLfloat amp)
    175 {
    176     glMatrixMode(GL_MODELVIEW);
    177     glLoadIdentity();
    178     glTranslatef(xOffs[i], yOffs[i], z);
    179     glTranslatef(0.5f, 0.5f, 0.5f);
    180     GLfloat scale = 0.75 + i*(0.25f/2);
    181     glScalef(scale, scale, scale);
    182     glRotatef(rot[i], 1.0f, 1.0f, 1.0f);
    183     glTranslatef(-0.5f, -0.5f, -0.5f);
    184 
    185     glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
    186     glDrawArrays(GL_QUADS, 0, 24);
    187 
    188     if (xOffs[i] > 1.0f || xOffs[i] < -1.0f) {
    189         xInc[i] = -xInc[i];
    190         xOffs[i] = xOffs[i] > 1.0f ? 1.0f : -1.0f;
    191     }
    192     xOffs[i] += xInc[i];
    193     yOffs[i] = qAbs(cos((-3.141592f * jmp) * xOffs[i]) * amp) - 1;
    194     rot[i] += rotation;
    195 }
    196 
    197 void GLWidget::initCommon()
    198 {
    199     glEnableClientState(GL_VERTEX_ARRAY);
    200     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    201     glVertexPointer(3, GL_INT, 0, cubeArray);
    202     glTexCoordPointer(2, GL_INT, 0, cubeTextureArray);
    203     glColorPointer(4, GL_UNSIGNED_BYTE, 0, colorArray);
    204 
    205     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    206     glEnable(GL_BLEND);
    207     glEnable(GL_TEXTURE_2D);
    208     glEnable(GL_DEPTH_TEST);
    209 
    210     glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    211 }
    212 
    213 void GLWidget::initPbuffer()
    214 {
    215     // set up the pbuffer context
    216     pbuffer->makeCurrent();
    217     initCommon();
    218 
    219     glViewport(0, 0, pbuffer->size().width(), pbuffer->size().height());
     184}
     185
     186void GLWidget::orthographicProjection()
     187{
    220188    glMatrixMode(GL_PROJECTION);
    221189    glLoadIdentity();
    222     glOrtho(-1, 1, -1, 1, -99, 99);
    223     glTranslatef(-0.5f, -0.5f, 0.0f);
     190#ifdef QT_OPENGL_ES
     191    glOrthof(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
     192#else
     193    glOrtho(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
     194#endif
    224195    glMatrixMode(GL_MODELVIEW);
    225     glLoadIdentity();
    226 
    227     pbufferList = glGenLists(1);
    228     glNewList(pbufferList, GL_COMPILE);
    229     {
    230         glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
    231 
    232         // draw cube background
    233         glPushMatrix();
    234         glLoadIdentity();
    235         glTranslatef(0.5f, 0.5f, -2.0f);
    236         glDisable(GL_TEXTURE_2D);
    237         glEnableClientState(GL_COLOR_ARRAY);
    238         glVertexPointer(2, GL_INT, 0, faceArray);
    239         glDrawArrays(GL_QUADS, 0, 4);
    240         glVertexPointer(3, GL_INT, 0, cubeArray);
    241         glDisableClientState(GL_COLOR_ARRAY);
    242         glEnable(GL_TEXTURE_2D);
    243         glPopMatrix();
    244 
    245         // draw cube
    246         glTranslatef(0.5f, 0.5f, 0.5f);
    247         glRotatef(3.0f, 1.0f, 1.0f, 1.0f);
    248         glTranslatef(-0.5f, -0.5f, -0.5f);
    249         glColor4f(0.9f, 0.9f, 0.9f, 1.0f);
    250         glDrawArrays(GL_QUADS, 0, 24);
    251     }
    252     glEndList();
     196}
     197
     198void GLWidget::resizeGL(int width, int height)
     199{
     200    glViewport(0, 0, width, height);
     201    aspect = (qreal)width / (qreal)(height ? height : 1);
     202    perspectiveProjection();
     203}
     204
     205void GLWidget::drawPbuffer()
     206{
     207    orthographicProjection();
     208
     209    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
     210    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     211
     212    glDisable(GL_TEXTURE_2D);
     213    backdrop->draw();
     214    glEnable(GL_TEXTURE_2D);
     215
     216    glBindTexture(GL_TEXTURE_2D, cubeTexture);
     217    glDisable(GL_CULL_FACE);
     218    cube->draw();
     219    glEnable(GL_CULL_FACE);
     220
     221    glFlush();
     222}
     223
     224void GLWidget::initPbuffer()
     225{
     226    pbuffer->makeCurrent();
     227
     228    cubeTexture = bindTexture(QImage(":res/cubelogo.png"));
     229
     230    initCommon();
     231
    253232    // generate a texture that has the same size/format as the pbuffer
    254233    dynamicTexture = pbuffer->generateDynamicTexture();
     
    259238}
    260239
     240void GLWidget::setAnimationPaused(bool enable)
     241{
     242    cube->setAnimationPaused(enable);
     243    for (int i = 0; i < 3; ++i)
     244        cubes[i]->setAnimationPaused(enable);
     245}
  • trunk/examples/opengl/pbuffers/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
    4040****************************************************************************/
    4141
    42 #include <QtOpenGL>
     42#ifndef GLWIDGET_H
     43#define GLWIDGET_H
     44
     45#include <QGLWidget>
     46
     47class Geometry;
     48class Cube;
     49class Tile;
     50QT_BEGIN_NAMESPACE
     51class QGLPixelBuffer;
     52QT_END_NAMESPACE
    4353
    4454class GLWidget : public QGLWidget
    4555{
    4656public:
    47     GLWidget(QWidget *parent);
     57    GLWidget(QWidget *parent = 0);
    4858    ~GLWidget();
     59
     60protected:
    4961    void initializeGL();
    50     void resizeGL(int w, int h);
    5162    void paintGL();
    52     void timerEvent(QTimerEvent *) { update(); }
    53     void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
    54     void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
    55 
    56     void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
    57     void initCommon();
    58     void initPbuffer();
     63    void resizeGL(int width, int height);
     64    void mousePressEvent(QMouseEvent *) { setAnimationPaused(true); }
     65    void mouseReleaseEvent(QMouseEvent *) { setAnimationPaused(false); }
    5966
    6067private:
    61     GLfloat rot[3], xOffs[3], yOffs[3], xInc[3];
    62     GLuint pbufferList;
     68    void initializeGeometry();
     69    void initPbuffer();
     70    void initCommon();
     71    void perspectiveProjection();
     72    void orthographicProjection();
     73    void drawPbuffer();
     74    void setAnimationPaused(bool enable);
     75
     76    qreal aspect;
    6377    GLuint dynamicTexture;
    6478    GLuint cubeTexture;
    65     int timerId;
    6679    bool hasDynamicTextureUpdate;
     80    QGLPixelBuffer *pbuffer;
     81    Geometry *geom;
     82    Cube *cube;
     83    Tile *backdrop;
     84    QList<Cube *> cubes;
     85    QList<Tile *> tiles;
    6786
    68     QGLPixelBuffer *pbuffer;
    6987};
     88//! [3]
    7089
     90#endif
  • trunk/examples/opengl/pbuffers/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include <QtGui/QApplication>
    4343#include <QtGui/QMessageBox>
     44#include <QtOpenGL/QGLPixelBuffer>
     45
    4446#include "glwidget.h"
    4547
  • trunk/examples/opengl/pbuffers/pbuffers.pro

    r2 r561  
    1 HEADERS += glwidget.h
    2 SOURCES += glwidget.cpp main.cpp
     1HEADERS += glwidget.h \
     2    cube.h
     3SOURCES += glwidget.cpp \
     4    main.cpp \
     5    cube.cpp
    36RESOURCES += pbuffers.qrc
    4 
    57QT += opengl
    68
    79# install
    810target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers
    9 sources.files = $$SOURCES $$HEADERS $$RESOURCES pbuffers.pro *.png
     11sources.files = $$SOURCES \
     12    $$HEADERS \
     13    $$RESOURCES \
     14    pbuffers.pro \
     15    *.png
    1016sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers
    11 INSTALLS += target sources
     17INSTALLS += target \
     18    sources
     19symbian:include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/pbuffers2/bubbles.svg

    r2 r561  
    7373                      cx="0" cy="0" r="100" fx="-50" fy="50">
    7474        <stop offset="0%" stop-color="black" stop-opacity="1.0" />
    75         <stop offset="100%" stop-color="white" stop-opacity="0.0" />
     75        <stop offset="100%" stop-color="black" stop-opacity="0.0" />
    7676      </radialGradient>
    7777
     
    9292  <g transform="translate(200,700)">
    9393    <use xlink:href="#bubble" fill="url(#blueBubble)" />
    94     <animateTransform attributeName="transform" type="translate"
     94    <animateTransform attributeName="transform" type="translate" additive="sum"
    9595        values="0,0; 0,-800" begin="1s" dur="10s" fill="freeze" repeatCount="indefinite" />
    9696  </g>
     
    9999      <use xlink:href="#bubble" fill="url(#redBubble)" />
    100100    </g>
    101     <animateTransform attributeName="transform" type="translate"
     101    <animateTransform attributeName="transform" type="translate" additive="sum"
    102102        values="0,0; 0,-800" begin="3s" dur="7s" fill="freeze" repeatCount="indefinite" />
    103103  </g>
     
    106106      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    107107    </g>
    108     <animateTransform attributeName="transform" type="translate"
     108    <animateTransform attributeName="transform" type="translate" additive="sum"
    109109        values="0,0; 0,-800" begin="5s" dur="9s" fill="freeze" repeatCount="indefinite" />
    110110  </g>
     
    113113      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    114114    </g>
    115     <animateTransform attributeName="transform" type="translate"
     115    <animateTransform attributeName="transform" type="translate" additive="sum"
    116116        values="0,0; 0,-800" begin="2s" dur="6s" fill="freeze" repeatCount="indefinite" />
    117117  </g>
     
    120120      <use xlink:href="#bubble" fill="url(#blueBubble)" />
    121121    </g>
    122     <animateTransform attributeName="transform" type="translate"
     122    <animateTransform attributeName="transform" type="translate" additive="sum"
    123123        values="0,0; 0,-800" begin="4s" dur="8s" fill="freeze" repeatCount="indefinite" />
    124124  </g>
     
    127127      <use xlink:href="#bubble" fill="url(#redBubble)" />
    128128    </g>
    129     <animateTransform attributeName="transform" type="translate"
     129    <animateTransform attributeName="transform" type="translate" additive="sum"
    130130        values="0,0; 0,-800" begin="1s" dur="4s" fill="freeze" repeatCount="indefinite" />
    131131  </g>
     
    134134      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    135135    </g>
    136     <animateTransform attributeName="transform" type="translate"
     136    <animateTransform attributeName="transform" type="translate" additive="sum"
    137137        values="0,0; 0,-800" begin="0s" dur="11s" fill="freeze" repeatCount="indefinite" />
    138138  </g>
     
    141141      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    142142    </g>
    143     <animateTransform attributeName="transform" type="translate"
     143    <animateTransform attributeName="transform" type="translate" additive="sum"
    144144        values="0,0; 0,-800" begin="3s" dur="7.5s" fill="freeze" repeatCount="indefinite" />
    145145  </g>
     
    149149      <use xlink:href="#bubble" fill="url(#blueBubble)" />
    150150    </g>
    151     <animateTransform attributeName="transform" type="translate"
     151    <animateTransform attributeName="transform" type="translate" additive="sum"
    152152        values="0,0; 0,-800" begin="3s" dur="6s" fill="freeze" repeatCount="indefinite" />
    153153  </g>
     
    156156      <use xlink:href="#bubble" fill="url(#redBubble)" />
    157157    </g>
    158     <animateTransform attributeName="transform" type="translate"
     158    <animateTransform attributeName="transform" type="translate" additive="sum"
    159159        values="0,0; 0,-800" begin="5.5s" dur="7s" fill="freeze" repeatCount="indefinite" />
    160160  </g>
     
    163163      <use xlink:href="#bubble" fill="url(#greenBubble)" />
    164164    </g>
    165     <animateTransform attributeName="transform" type="translate"
     165    <animateTransform attributeName="transform" type="translate" additive="sum"
    166166        values="0,0; 0,-800" begin="1s" dur="9s" fill="freeze" repeatCount="indefinite" />
    167167  </g>
     
    170170      <use xlink:href="#bubble" fill="url(#yellowBubble)" />
    171171    </g>
    172     <animateTransform attributeName="transform" type="translate"
     172    <animateTransform attributeName="transform" type="translate" additive="sum"
    173173        values="0,0; 0,-800" begin="2s" dur="9.5s" fill="freeze" repeatCount="indefinite" />
    174174  </g>
     
    187187      <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
    188188                            L -11,22 L -1,12 Z" />
    189       <animateTransform attributeName="transform"  type="rotate" values="0; 360"
     189      <animateTransform attributeName="transform"  type="rotate" additive="sum" values="0; 360"
    190190                 begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" />
    191191    </g>
  • trunk/examples/opengl/pbuffers2/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    137137
    138138    // save the GL state set for QPainter
     139    p.beginNativePainting();
    139140    saveGLState();
    140141
     
    207208    // restore the GL state that QPainter expects
    208209    restoreGLState();
     210    p.endNativePainting();
    209211
    210212    // draw the overlayed text using QPainter
  • trunk/examples/opengl/pbuffers2/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/pbuffers2/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/pbuffers2/pbuffers2.pro

    r2 r561  
    2020sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers2
    2121INSTALLS += target sources
     22
     23symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/samplebuffers/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    107107void GLWidget::makeObject()
    108108{
    109     QColor trolltechGreen(QColor::fromCmykF(0.40, 0.0, 1.0, 0.0));
     109    QColor qtGreen(QColor::fromCmykF(0.40, 0.0, 1.0, 0.0));
    110110    const double Pi = 3.14159265358979323846;
    111111    const int NumSectors = 15;
     
    135135            GLdouble y8 = 0.30 * cos(angle2);
    136136
    137             qglColor(trolltechGreen);
     137            qglColor(qtGreen);
    138138            quad(GL_QUADS, x5, y5, x6, y6, x7, y7, x8, y8);
    139139            qglColor(Qt::black);
     
    141141        }
    142142
    143         qglColor(trolltechGreen);
     143        qglColor(qtGreen);
    144144        quad(GL_QUADS, x1, y1, x2, y2, y2, x2, y1, x1);
    145145        quad(GL_QUADS, x3, y3, x4, y4, y4, x4, y3, x3);
  • trunk/examples/opengl/samplebuffers/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/samplebuffers/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/samplebuffers/samplebuffers.pro

    r2 r561  
    99sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/samplebuffers
    1010INSTALLS += target sources
     11
     12symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/textures/glwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4343#include <QtOpenGL>
    4444
    45 #include <math.h>
    46 
    4745#include "glwidget.h"
    48 
    49 GLuint GLWidget::sharedObject = 0;
    50 int GLWidget::refCount = 0;
    5146
    5247GLWidget::GLWidget(QWidget *parent, QGLWidget *shareWidget)
     
    5752    yRot = 0;
    5853    zRot = 0;
     54#ifdef QT_OPENGL_ES_2
     55    program = 0;
     56#endif
    5957}
    6058
    6159GLWidget::~GLWidget()
    6260{
    63     if (--refCount == 0) {
    64         makeCurrent();
    65         glDeleteLists(sharedObject, 1);
    66     }
    6761}
    6862
     
    9387void GLWidget::initializeGL()
    9488{
    95     if (!sharedObject)
    96         sharedObject = makeObject();
    97     ++refCount;
     89    makeObject();
    9890
    9991    glEnable(GL_DEPTH_TEST);
    10092    glEnable(GL_CULL_FACE);
     93#ifndef QT_OPENGL_ES_2
    10194    glEnable(GL_TEXTURE_2D);
     95#endif
     96
     97#ifdef QT_OPENGL_ES_2
     98
     99#define PROGRAM_VERTEX_ATTRIBUTE 0
     100#define PROGRAM_TEXCOORD_ATTRIBUTE 1
     101
     102    QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
     103    const char *vsrc =
     104        "attribute highp vec4 vertex;\n"
     105        "attribute mediump vec4 texCoord;\n"
     106        "varying mediump vec4 texc;\n"
     107        "uniform mediump mat4 matrix;\n"
     108        "void main(void)\n"
     109        "{\n"
     110        "    gl_Position = matrix * vertex;\n"
     111        "    texc = texCoord;\n"
     112        "}\n";
     113    vshader->compileSourceCode(vsrc);
     114
     115    QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
     116    const char *fsrc =
     117        "uniform sampler2D texture;\n"
     118        "varying mediump vec4 texc;\n"
     119        "void main(void)\n"
     120        "{\n"
     121        "    gl_FragColor = texture2D(texture, texc.st);\n"
     122        "}\n";
     123    fshader->compileSourceCode(fsrc);
     124
     125    program = new QGLShaderProgram(this);
     126    program->addShader(vshader);
     127    program->addShader(fshader);
     128    program->bindAttributeLocation("vertex", PROGRAM_VERTEX_ATTRIBUTE);
     129    program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE);
     130    program->link();
     131
     132    program->bind();
     133    program->setUniformValue("texture", 0);
     134
     135#endif
    102136}
    103137
     
    106140    qglClearColor(clearColor);
    107141    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     142
     143#if !defined(QT_OPENGL_ES_2)
     144
    108145    glLoadIdentity();
    109     glTranslated(0.0, 0.0, -10.0);
    110     glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
    111     glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
    112     glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
    113     glCallList(sharedObject);
     146    glTranslatef(0.0f, 0.0f, -10.0f);
     147    glRotatef(xRot / 16.0f, 1.0f, 0.0f, 0.0f);
     148    glRotatef(yRot / 16.0f, 0.0f, 1.0f, 0.0f);
     149    glRotatef(zRot / 16.0f, 0.0f, 0.0f, 1.0f);
     150
     151    glVertexPointer(3, GL_FLOAT, 0, vertices.constData());
     152    glTexCoordPointer(2, GL_FLOAT, 0, texCoords.constData());
     153    glEnableClientState(GL_VERTEX_ARRAY);
     154    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
     155
     156#else
     157
     158    QMatrix4x4 m;
     159    m.ortho(-0.5f, +0.5f, +0.5f, -0.5f, 4.0f, 15.0f);
     160    m.translate(0.0f, 0.0f, -10.0f);
     161    m.rotate(xRot / 16.0f, 1.0f, 0.0f, 0.0f);
     162    m.rotate(yRot / 16.0f, 0.0f, 1.0f, 0.0f);
     163    m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f);
     164
     165    program->setUniformValue("matrix", m);
     166    program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE);
     167    program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE);
     168    program->setAttributeArray
     169        (PROGRAM_VERTEX_ATTRIBUTE, vertices.constData());
     170    program->setAttributeArray
     171        (PROGRAM_TEXCOORD_ATTRIBUTE, texCoords.constData());
     172
     173#endif
     174
     175    for (int i = 0; i < 6; ++i) {
     176        glBindTexture(GL_TEXTURE_2D, textures[i]);
     177        glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
     178    }
    114179}
    115180
     
    119184    glViewport((width - side) / 2, (height - side) / 2, side, side);
    120185
     186#if !defined(QT_OPENGL_ES_2)
    121187    glMatrixMode(GL_PROJECTION);
    122188    glLoadIdentity();
     189#ifndef QT_OPENGL_ES
    123190    glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
     191#else
     192    glOrthof(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
     193#endif
    124194    glMatrixMode(GL_MODELVIEW);
     195#endif
    125196}
    126197
     
    148219}
    149220
    150 GLuint GLWidget::makeObject()
     221void GLWidget::makeObject()
    151222{
    152223    static const int coords[6][4][3] = {
     
    159230    };
    160231
    161 
    162     GLuint textures[6];
    163     for (int j=0; j < 6; ++j)
    164         textures[j] = bindTexture(QPixmap(QString(":/images/side%1.png").arg(j + 1)),
    165                                   GL_TEXTURE_2D);
    166 
    167     GLuint list = glGenLists(1);
    168     glNewList(list, GL_COMPILE);
     232    for (int j=0; j < 6; ++j) {
     233        textures[j] = bindTexture
     234            (QPixmap(QString(":/images/side%1.png").arg(j + 1)), GL_TEXTURE_2D);
     235    }
     236
    169237    for (int i = 0; i < 6; ++i) {
    170         glBindTexture(GL_TEXTURE_2D, textures[i]);
    171         glBegin(GL_QUADS);
    172238        for (int j = 0; j < 4; ++j) {
    173             glTexCoord2d(j == 0 || j == 3, j == 0 || j == 1);
    174             glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1],
    175                        0.2 * coords[i][j][2]);
     239            texCoords.append
     240                (QVector2D(j == 0 || j == 3, j == 0 || j == 1));
     241            vertices.append
     242                (QVector3D(0.2 * coords[i][j][0], 0.2 * coords[i][j][1],
     243                           0.2 * coords[i][j][2]));
    176244        }
    177         glEnd();
    178     }
    179 
    180     glEndList();
    181     return list;
    182 }
     245    }
     246}
  • trunk/examples/opengl/textures/glwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4343#define GLWIDGET_H
    4444
     45#include <QtGui>
    4546#include <QGLWidget>
     47
     48class QGLShaderProgram;
    4649
    4750class GLWidget : public QGLWidget
     
    7073
    7174private:
    72     GLuint makeObject();
     75    void makeObject();
    7376
    7477    QColor clearColor;
     
    7780    int yRot;
    7881    int zRot;
    79 
    80     static GLuint sharedObject;
    81     static int refCount;
     82    GLuint textures[6];
     83    QVector<QVector3D> vertices;
     84    QVector<QVector2D> texCoords;
     85#ifdef QT_OPENGL_ES_2
     86    QGLShaderProgram *program;
     87#endif
    8288};
    8389
  • trunk/examples/opengl/textures/main.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/examples/opengl/textures/textures.pro

    r2 r561  
    1212sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures
    1313INSTALLS += target sources
     14
     15symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
  • trunk/examples/opengl/textures/window.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949    QGridLayout *mainLayout = new QGridLayout;
    5050
    51     glWidgets[0][0] = 0;
    52 
    5351    for (int i = 0; i < NumRows; ++i) {
    5452        for (int j = 0; j < NumColumns; ++j) {
     
    5856                              255, 63);
    5957
    60             glWidgets[i][j] = new GLWidget(0, glWidgets[0][0]);
     58            glWidgets[i][j] = new GLWidget(0, 0);
    6159            glWidgets[i][j]->setClearColor(clearColor);
    6260            glWidgets[i][j]->rotateBy(+42 * 16, +42 * 16, -21 * 16);
  • trunk/examples/opengl/textures/window.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the examples of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
Note: See TracChangeset for help on using the changeset viewer.