Changeset 561 for trunk/examples/opengl
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 74 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/examples/opengl/2dpainting/2dpainting.pro
r2 r561 16 16 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/2dpainting 17 17 INSTALLS += target sources 18 19 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/2dpainting/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/helper.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/helper.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/widget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/widget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/window.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/2dpainting/window.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/framebufferobject/bubbles.svg
r2 r561 73 73 cx="0" cy="0" r="100" fx="-50" fy="50"> 74 74 <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" /> 76 76 </radialGradient> 77 77 … … 92 92 <g transform="translate(200,700)"> 93 93 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 94 <animateTransform attributeName="transform" type="translate" 94 <animateTransform attributeName="transform" type="translate" additive="sum" 95 95 values="0,0; 0,-800" begin="1s" dur="10s" fill="freeze" repeatCount="indefinite" /> 96 96 </g> … … 99 99 <use xlink:href="#bubble" fill="url(#redBubble)" /> 100 100 </g> 101 <animateTransform attributeName="transform" type="translate" 101 <animateTransform attributeName="transform" type="translate" additive="sum" 102 102 values="0,0; 0,-800" begin="3s" dur="7s" fill="freeze" repeatCount="indefinite" /> 103 103 </g> … … 106 106 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 107 107 </g> 108 <animateTransform attributeName="transform" type="translate" 108 <animateTransform attributeName="transform" type="translate" additive="sum" 109 109 values="0,0; 0,-800" begin="5s" dur="9s" fill="freeze" repeatCount="indefinite" /> 110 110 </g> … … 113 113 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 114 114 </g> 115 <animateTransform attributeName="transform" type="translate" 115 <animateTransform attributeName="transform" type="translate" additive="sum" 116 116 values="0,0; 0,-800" begin="2s" dur="6s" fill="freeze" repeatCount="indefinite" /> 117 117 </g> … … 120 120 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 121 121 </g> 122 <animateTransform attributeName="transform" type="translate" 122 <animateTransform attributeName="transform" type="translate" additive="sum" 123 123 values="0,0; 0,-800" begin="4s" dur="8s" fill="freeze" repeatCount="indefinite" /> 124 124 </g> … … 127 127 <use xlink:href="#bubble" fill="url(#redBubble)" /> 128 128 </g> 129 <animateTransform attributeName="transform" type="translate" 129 <animateTransform attributeName="transform" type="translate" additive="sum" 130 130 values="0,0; 0,-800" begin="1s" dur="4s" fill="freeze" repeatCount="indefinite" /> 131 131 </g> … … 134 134 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 135 135 </g> 136 <animateTransform attributeName="transform" type="translate" 136 <animateTransform attributeName="transform" type="translate" additive="sum" 137 137 values="0,0; 0,-800" begin="0s" dur="11s" fill="freeze" repeatCount="indefinite" /> 138 138 </g> … … 141 141 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 142 142 </g> 143 <animateTransform attributeName="transform" type="translate" 143 <animateTransform attributeName="transform" type="translate" additive="sum" 144 144 values="0,0; 0,-800" begin="3s" dur="7.5s" fill="freeze" repeatCount="indefinite" /> 145 145 </g> … … 149 149 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 150 150 </g> 151 <animateTransform attributeName="transform" type="translate" 151 <animateTransform attributeName="transform" type="translate" additive="sum" 152 152 values="0,0; 0,-800" begin="3s" dur="6s" fill="freeze" repeatCount="indefinite" /> 153 153 </g> … … 156 156 <use xlink:href="#bubble" fill="url(#redBubble)" /> 157 157 </g> 158 <animateTransform attributeName="transform" type="translate" 158 <animateTransform attributeName="transform" type="translate" additive="sum" 159 159 values="0,0; 0,-800" begin="5.5s" dur="7s" fill="freeze" repeatCount="indefinite" /> 160 160 </g> … … 163 163 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 164 164 </g> 165 <animateTransform attributeName="transform" type="translate" 165 <animateTransform attributeName="transform" type="translate" additive="sum" 166 166 values="0,0; 0,-800" begin="1s" dur="9s" fill="freeze" repeatCount="indefinite" /> 167 167 </g> … … 170 170 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 171 171 </g> 172 <animateTransform attributeName="transform" type="translate" 172 <animateTransform attributeName="transform" type="translate" additive="sum" 173 173 values="0,0; 0,-800" begin="2s" dur="9.5s" fill="freeze" repeatCount="indefinite" /> 174 174 </g> … … 187 187 <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10 188 188 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" 190 190 begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" /> 191 191 </g> -
trunk/examples/opengl/framebufferobject/framebufferobject.pro
r2 r561 21 21 INSTALLS += target sources 22 22 23 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) 24 -
trunk/examples/opengl/framebufferobject/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 54 54 setWindowTitle(tr("OpenGL framebuffer objects")); 55 55 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 57 69 rot_x = rot_y = rot_z = 0.0f; 58 70 scale = 0.1f; … … 114 126 delete[] wave; 115 127 glDeleteLists(tile_list, 1); 116 delete fbo; 128 delete texture_fbo; 129 if (render_fbo != texture_fbo) 130 delete render_fbo; 117 131 } 118 132 … … 130 144 131 145 // render the 'bubbles.svg' file into our framebuffer object 132 QPainter fbo_painter( fbo);146 QPainter fbo_painter(render_fbo); 133 147 svg_renderer->render(&fbo_painter); 134 148 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 } 135 155 136 156 // draw into the GL widget … … 146 166 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 147 167 148 glBindTexture(GL_TEXTURE_2D, fbo->texture());168 glBindTexture(GL_TEXTURE_2D, texture_fbo->texture()); 149 169 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 170 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 150 171 glEnable(GL_TEXTURE_2D); 151 172 glEnable(GL_MULTISAMPLE); -
trunk/examples/opengl/framebufferobject/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 78 78 QTimeLine *anim; 79 79 QSvgRenderer *svg_renderer; 80 QGLFramebufferObject *fbo; 80 QGLFramebufferObject *render_fbo; 81 QGLFramebufferObject *texture_fbo; 81 82 }; 82 83 -
trunk/examples/opengl/framebufferobject/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/framebufferobject2/framebufferobject2.pro
r2 r561 10 10 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/framebufferobject2 11 11 INSTALLS += target sources 12 13 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/framebufferobject2/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 209 209 for (int x = 0; x < 5; ++x) { 210 210 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); 212 212 glDrawArrays(GL_QUADS, 0, 4); 213 213 } -
trunk/examples/opengl/framebufferobject2/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/framebufferobject2/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/grabber/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/grabber/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/grabber/grabber.pro
r2 r561 11 11 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/grabber 12 12 INSTALLS += target sources 13 14 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/grabber/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/grabber/mainwindow.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 137 137 138 138 exitAct = new QAction(tr("E&xit"), this); 139 exitAct->setShortcut (tr("Ctrl+Q"));139 exitAct->setShortcuts(QKeySequence::Quit); 140 140 connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); 141 141 -
trunk/examples/opengl/grabber/mainwindow.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 46 46 47 47 #include "glwidget.h" 48 #include "qtlogo.h" 49 50 #ifndef GL_MULTISAMPLE 51 #define GL_MULTISAMPLE 0x809D 52 #endif 48 53 49 54 //! [0] 50 55 GLWidget::GLWidget(QWidget *parent) 51 : QGLWidget( parent)52 { 53 object= 0;56 : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) 57 { 58 logo = 0; 54 59 xRot = 0; 55 60 yRot = 0; 56 61 zRot = 0; 57 62 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); 60 65 } 61 66 //! [0] … … 64 69 GLWidget::~GLWidget() 65 70 { 66 makeCurrent();67 glDeleteLists(object, 1);68 71 } 69 72 //! [1] … … 84 87 //! [4] 85 88 89 static void qNormalizeAngle(int &angle) 90 { 91 while (angle < 0) 92 angle += 360 * 16; 93 while (angle > 360 * 16) 94 angle -= 360 * 16; 95 } 96 86 97 //! [5] 87 98 void GLWidget::setXRotation(int angle) 88 99 { 89 normalizeAngle(&angle);100 qNormalizeAngle(angle); 90 101 if (angle != xRot) { 91 102 xRot = angle; … … 98 109 void GLWidget::setYRotation(int angle) 99 110 { 100 normalizeAngle(&angle);111 qNormalizeAngle(angle); 101 112 if (angle != yRot) { 102 113 yRot = angle; … … 108 119 void GLWidget::setZRotation(int angle) 109 120 { 110 normalizeAngle(&angle);121 qNormalizeAngle(angle); 111 122 if (angle != zRot) { 112 123 zRot = angle; … … 119 130 void GLWidget::initializeGL() 120 131 { 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 124 137 glEnable(GL_DEPTH_TEST); 125 138 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); 126 145 } 127 146 //! [6] … … 132 151 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 133 152 glLoadIdentity(); 134 glTranslate d(0.0, 0.0, -10.0);135 glRotate d(xRot / 16.0, 1.0, 0.0, 0.0);136 glRotate d(yRot / 16.0, 0.0, 1.0, 0.0);137 glRotate d(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(); 139 158 } 140 159 //! [7] … … 148 167 glMatrixMode(GL_PROJECTION); 149 168 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 151 174 glMatrixMode(GL_MODELVIEW); 152 175 } … … 176 199 } 177 200 //! [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 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 44 44 45 45 #include <QGLWidget> 46 47 class QtLogo; 46 48 47 49 //! [0] … … 81 83 //! [3] 82 84 private: 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; 90 86 int xRot; 91 87 int yRot; 92 88 int zRot; 93 89 QPoint lastPos; 94 QColor trolltechGreen;95 QColor trolltechPurple;90 QColor qtGreen; 91 QColor qtPurple; 96 92 }; 97 93 //! [3] -
trunk/examples/opengl/hellogl/hellogl.pro
r2 r561 1 VPATH += ../shared 2 INCLUDEPATH += ../shared 3 1 4 HEADERS = glwidget.h \ 2 window.h 5 window.h \ 6 qtlogo.h 3 7 SOURCES = glwidget.cpp \ 4 8 main.cpp \ 5 window.cpp 9 window.cpp \ 10 qtlogo.cpp 6 11 QT += opengl 7 12 … … 11 16 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl 12 17 INSTALLS += target sources 18 19 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/hellogl/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 41 41 42 42 #include <QApplication> 43 #include <QDesktopWidget> 43 44 44 45 #include "window.h" … … 48 49 QApplication app(argc, argv); 49 50 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(); 51 59 return app.exec(); 52 60 } -
trunk/examples/opengl/hellogl/window.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 89 89 } 90 90 //! [2] 91 92 void 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 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 Window(); 59 59 60 protected: 61 void keyPressEvent(QKeyEvent *event); 62 60 63 private: 61 64 QSlider *createSlider(); -
trunk/examples/opengl/hellogl_es/bubble.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/bubble.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/cl_helper.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/hellogl_es.pro
r2 r561 21 21 QT += opengl 22 22 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 30 23 # install 31 24 target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es -
trunk/examples/opengl/hellogl_es/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/mainwindow.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es/mainwindow.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es2/bubble.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es2/bubble.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es2/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include "glwidget.h" 43 43 #include <QPainter> 44 #include <QPaintEngine> 44 45 #include <math.h> 45 46 … … 48 49 49 50 const 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_PI113 #define M_PI 3.14159265358979323846114 #endif115 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 }161 51 162 52 GLWidget::GLWidget(QWidget *parent) … … 164 54 { 165 55 qtLogo = true; 166 createdVertices = 0;167 createdNormals = 0;168 m_vertexNumber = 0;169 56 frames = 0; 170 57 setAttribute(Qt::WA_PaintOnScreen); … … 179 66 GLWidget::~GLWidget() 180 67 { 181 if (createdVertices)182 delete[] createdVertices;183 if (createdNormals)184 delete[] createdNormals;185 68 } 186 69 … … 210 93 void GLWidget::paintQtLogo() 211 94 { 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); 220 102 } 221 103 222 104 void GLWidget::paintTexturedCube() 223 105 { 224 glEnable(GL_TEXTURE_2D);225 106 glBindTexture(GL_TEXTURE_2D, m_uiTexture); 226 107 GLfloat afVertices[] = { … … 240 121 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5 241 122 }; 242 glVertexAttribPointer(vertexAttr2, 3, GL_FLOAT, GL_FALSE, 0, afVertices); 243 glEnableVertexAttribArray(vertexAttr2); 123 program2.setAttributeArray(vertexAttr2, afVertices, 3); 244 124 245 125 GLfloat afTexCoord[] = { … … 259 139 0.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f 260 140 }; 261 glVertexAttribPointer(texCoordAttr2, 2, GL_FLOAT, GL_FALSE, 0, afTexCoord); 262 glEnableVertexAttribArray(texCoordAttr2); 141 program2.setAttributeArray(texCoordAttr2, afTexCoord, 2); 263 142 264 143 GLfloat afNormals[] = { … … 279 158 0,1,0, 0,1,0, 0,1,0 280 159 }; 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); 285 167 286 168 glDrawArrays(GL_TRIANGLES, 0, 36); 287 169 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); 325 173 } 326 174 … … 329 177 glClearColor(0.1f, 0.1f, 0.2f, 1.0f); 330 178 331 glEnable(GL_TEXTURE_2D);332 179 glGenTextures(1, &m_uiTexture); 333 180 m_uiTexture = bindTexture(QImage(":/qt.png")); 334 181 335 GLuint vshader1 = glCreateShader(GL_VERTEX_SHADER);336 const char *vsrc1 [1] = {182 QGLShader *vshader1 = new QGLShader(QGLShader::Vertex, this); 183 const char *vsrc1 = 337 184 "attribute highp vec4 vertex;\n" 338 185 "attribute mediump vec3 normal;\n" … … 347 194 " color = clamp(color, 0.0, 1.0);\n" 348 195 " 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 = 357 201 "varying mediump vec4 color;\n" 358 202 "void main(void)\n" 359 203 "{\n" 360 204 " 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 = 379 218 "attribute highp vec4 vertex;\n" 380 219 "attribute highp vec4 texCoord;\n" … … 389 228 " gl_Position = matrix * vertex;\n" 390 229 " 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 = 399 235 "varying highp vec4 texc;\n" 400 236 "uniform sampler2D tex;\n" … … 405 241 " color = color * 0.2 + color * 0.8 * angle;\n" 406 242 " 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"); 424 255 425 256 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); … … 439 270 painter.begin(this); 440 271 272 painter.beginNativePainting(); 273 441 274 glClearColor(0.1f, 0.1f, 0.2f, 1.0f); 442 275 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 443 glEnable(GL_TEXTURE_2D);444 276 445 277 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); … … 451 283 glEnable(GL_DEPTH_TEST); 452 284 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); 460 291 461 292 if (qtLogo) { 462 glUseProgram(program1);463 glUniformMatrix4fv(matrixUniform1, 1, GL_FALSE, modelview);293 program1.bind(); 294 program1.setUniformValue(matrixUniform1, modelview); 464 295 paintQtLogo(); 465 glUseProgram(0);296 program1.release(); 466 297 } else { 467 glUseProgram(program2);468 glUniformMatrix4fv(matrixUniform2, 1, GL_FALSE, modelview);298 program2.bind(); 299 program1.setUniformValue(matrixUniform2, modelview); 469 300 paintTexturedCube(); 470 glUseProgram(0);301 program2.release(); 471 302 } 472 303 473 304 glDisable(GL_DEPTH_TEST); 474 305 glDisable(GL_CULL_FACE); 306 307 painter.endNativePainting(); 475 308 476 309 if (m_showBubbles) … … 564 397 } 565 398 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; 575 401 } 576 402 577 403 void GLWidget::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4) 578 404 { 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; 618 442 } 619 443 620 444 void GLWidget::extrude(qreal x1, qreal y1, qreal x2, qreal y2) 621 445 { 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 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 44 44 45 45 #include <QGLWidget> 46 #include <QtGui/qvector3d.h> 47 #include <QtGui/qmatrix4x4.h> 48 #include <QtOpenGL/qglshaderprogram.h> 46 49 #include <QTime> 50 #include <QVector> 47 51 48 52 class Bubble; … … 72 76 void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4); 73 77 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; 79 80 bool qtLogo; 80 81 QList<Bubble*> bubbles; 81 82 int frames; 82 83 QTime time; 83 GLuintprogram1;84 GLuintprogram2;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; 93 94 }; 94 95 #endif -
trunk/examples/opengl/hellogl_es2/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es2/mainwindow.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/hellogl_es2/mainwindow.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/opengl.pro
r2 r561 6 6 } else { 7 7 SUBDIRS = hellogl_es 8 } 9 !contains(QT_CONFIG, opengles1cl) { 10 SUBDIRS += textures 11 } 12 contains(QT_CONFIG, opengles1) { 13 SUBDIRS += hellogl 8 14 } 9 15 } else { … … 28 34 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl 29 35 INSTALLS += target sources 36 37 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/overpainting/bubble.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/overpainting/bubble.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/overpainting/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 47 47 48 48 #include "bubble.h" 49 #include "qtlogo.h" 49 50 #include "glwidget.h" 50 51 … … 60 61 qsrand(midnight.secsTo(QTime::currentTime())); 61 62 62 object= 0;63 logo = 0; 63 64 xRot = 0; 64 65 yRot = 0; 65 66 zRot = 0; 66 67 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); 69 70 70 71 animationTimer.setSingleShot(false); … … 81 82 GLWidget::~GLWidget() 82 83 { 83 makeCurrent();84 glDeleteLists(object, 1);85 84 } 86 85 //! [1] 87 86 87 static void qNormalizeAngle(int &angle) 88 { 89 while (angle < 0) 90 angle += 360 * 16; 91 while (angle > 360 * 16) 92 angle -= 360 * 16; 93 } 94 88 95 void GLWidget::setXRotation(int angle) 89 96 { 90 normalizeAngle(&angle);97 qNormalizeAngle(angle); 91 98 if (angle != xRot) 92 99 xRot = angle; … … 95 102 void GLWidget::setYRotation(int angle) 96 103 { 97 normalizeAngle(&angle);104 qNormalizeAngle(angle); 98 105 if (angle != yRot) 99 106 yRot = angle; … … 102 109 void GLWidget::setZRotation(int angle) 103 110 { 104 normalizeAngle(&angle);111 qNormalizeAngle(angle); 105 112 if (angle != zRot) 106 113 zRot = angle; … … 110 117 void GLWidget::initializeGL() 111 118 { 112 object = makeObject(); 119 glEnable(GL_MULTISAMPLE); 120 121 logo = new QtLogo(this); 122 logo->setColor(qtGreen.dark()); 113 123 } 114 124 //! [2] … … 143 153 144 154 //! [6] 145 qglClearColor( trolltechPurple.dark());155 qglClearColor(qtPurple.dark()); 146 156 glShadeModel(GL_SMOOTH); 147 157 glEnable(GL_DEPTH_TEST); … … 159 169 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 160 170 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(); 166 177 //! [7] 167 178 168 179 //! [8] 180 glShadeModel(GL_FLAT); 181 glDisable(GL_CULL_FACE); 182 glDisable(GL_DEPTH_TEST); 183 glDisable(GL_LIGHTING); 184 169 185 glMatrixMode(GL_MODELVIEW); 170 186 glPopMatrix(); … … 203 219 } 204 220 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 301 221 void GLWidget::createBubbles(int number) 302 222 { … … 333 253 glMatrixMode(GL_PROJECTION); 334 254 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 336 260 glMatrixMode(GL_MODELVIEW); 337 261 } -
trunk/examples/opengl/overpainting/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 51 51 52 52 class Bubble; 53 class QtLogo; 53 54 QT_BEGIN_NAMESPACE 54 55 class QPaintEvent; … … 89 90 90 91 private: 91 GLuint makeObject();92 92 void createBubbles(int number); 93 93 void drawInstructions(QPainter *painter); 94 94 //! [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);99 95 void setupViewport(int width, int height); 96 97 QColor qtGreen; 98 QColor qtPurple; 100 99 101 100 GLuint object; … … 104 103 int zRot; 105 104 QPoint lastPos; 106 QColor trolltechGreen;107 QColor trolltechPurple;108 105 //! [4] 106 QtLogo *logo; 109 107 QList<Bubble*> bubbles; 110 108 QTimer animationTimer; 109 //! [4] 111 110 }; 112 //! [4]113 111 114 112 #endif -
trunk/examples/opengl/overpainting/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/overpainting/overpainting.pro
r2 r561 1 QT += opengl 1 VPATH += ../shared 2 INCLUDEPATH += ../shared 2 3 3 HEADERS = bubble.h \ 4 glwidget.h 5 SOURCES = bubble.cpp \ 6 glwidget.cpp \ 7 main.cpp 4 QT += opengl 5 HEADERS = bubble.h \ 6 glwidget.h \ 7 qtlogo.h 8 SOURCES = bubble.cpp \ 9 glwidget.cpp \ 10 main.cpp \ 11 qtlogo.cpp 8 12 9 13 # install 10 14 target.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting 11 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS overpainting.pro 15 sources.files = $$SOURCES \ 16 $$HEADERS \ 17 $$RESOURCES \ 18 $$FORMS \ 19 overpainting.pro 12 20 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting 13 INSTALLS += target sources 21 INSTALLS += target \ 22 sources 23 symbian:include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/pbuffers/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 41 41 42 42 #include "glwidget.h" 43 #include <QtGui/QImage>44 45 43 #include <math.h> 46 44 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 53 static 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} 54 58 }; 55 59 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 76 60 GLWidget::GLWidget(QWidget *parent) 77 : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) 61 : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) 62 , geom(0) 63 , cube(0) 78 64 { 79 65 // create the pbuffer 80 66 pbuffer = new QGLPixelBuffer(QSize(512, 512), format(), this); 81 timerId = startTimer(20);82 67 setWindowTitle(tr("OpenGL pbuffers")); 68 initializeGeometry(); 83 69 } 84 70 … … 87 73 pbuffer->releaseFromDynamicTexture(); 88 74 glDeleteTextures(1, &dynamicTexture); 89 glDeleteLists(pbufferList, 1);90 75 delete pbuffer; 76 77 qDeleteAll(cubes); 78 qDeleteAll(tiles); 79 delete cube; 91 80 } 92 81 93 82 void GLWidget::initializeGL() 94 83 { 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 100 void 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 131 void 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 158 void GLWidget::initCommon() 159 { 160 qglClearColor(QColor(Qt::darkGray)); 161 162 glEnable(GL_DEPTH_TEST); 97 163 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 174 void GLWidget::perspectiveProjection() 175 { 116 176 glMatrixMode(GL_PROJECTION); 117 177 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 144 183 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 186 void GLWidget::orthographicProjection() 187 { 220 188 glMatrixMode(GL_PROJECTION); 221 189 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 224 195 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 198 void 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 205 void 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 224 void GLWidget::initPbuffer() 225 { 226 pbuffer->makeCurrent(); 227 228 cubeTexture = bindTexture(QImage(":res/cubelogo.png")); 229 230 initCommon(); 231 253 232 // generate a texture that has the same size/format as the pbuffer 254 233 dynamicTexture = pbuffer->generateDynamicTexture(); … … 259 238 } 260 239 240 void 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 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 41 42 #include <QtOpenGL> 42 #ifndef GLWIDGET_H 43 #define GLWIDGET_H 44 45 #include <QGLWidget> 46 47 class Geometry; 48 class Cube; 49 class Tile; 50 QT_BEGIN_NAMESPACE 51 class QGLPixelBuffer; 52 QT_END_NAMESPACE 43 53 44 54 class GLWidget : public QGLWidget 45 55 { 46 56 public: 47 GLWidget(QWidget *parent );57 GLWidget(QWidget *parent = 0); 48 58 ~GLWidget(); 59 60 protected: 49 61 void initializeGL(); 50 void resizeGL(int w, int h);51 62 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); } 59 66 60 67 private: 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; 63 77 GLuint dynamicTexture; 64 78 GLuint cubeTexture; 65 int timerId;66 79 bool hasDynamicTextureUpdate; 80 QGLPixelBuffer *pbuffer; 81 Geometry *geom; 82 Cube *cube; 83 Tile *backdrop; 84 QList<Cube *> cubes; 85 QList<Tile *> tiles; 67 86 68 QGLPixelBuffer *pbuffer;69 87 }; 88 //! [3] 70 89 90 #endif -
trunk/examples/opengl/pbuffers/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include <QtGui/QApplication> 43 43 #include <QtGui/QMessageBox> 44 #include <QtOpenGL/QGLPixelBuffer> 45 44 46 #include "glwidget.h" 45 47 -
trunk/examples/opengl/pbuffers/pbuffers.pro
r2 r561 1 HEADERS += glwidget.h 2 SOURCES += glwidget.cpp main.cpp 1 HEADERS += glwidget.h \ 2 cube.h 3 SOURCES += glwidget.cpp \ 4 main.cpp \ 5 cube.cpp 3 6 RESOURCES += pbuffers.qrc 4 5 7 QT += opengl 6 8 7 9 # install 8 10 target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers 9 sources.files = $$SOURCES $$HEADERS $$RESOURCES pbuffers.pro *.png 11 sources.files = $$SOURCES \ 12 $$HEADERS \ 13 $$RESOURCES \ 14 pbuffers.pro \ 15 *.png 10 16 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers 11 INSTALLS += target sources 17 INSTALLS += target \ 18 sources 19 symbian:include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/pbuffers2/bubbles.svg
r2 r561 73 73 cx="0" cy="0" r="100" fx="-50" fy="50"> 74 74 <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" /> 76 76 </radialGradient> 77 77 … … 92 92 <g transform="translate(200,700)"> 93 93 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 94 <animateTransform attributeName="transform" type="translate" 94 <animateTransform attributeName="transform" type="translate" additive="sum" 95 95 values="0,0; 0,-800" begin="1s" dur="10s" fill="freeze" repeatCount="indefinite" /> 96 96 </g> … … 99 99 <use xlink:href="#bubble" fill="url(#redBubble)" /> 100 100 </g> 101 <animateTransform attributeName="transform" type="translate" 101 <animateTransform attributeName="transform" type="translate" additive="sum" 102 102 values="0,0; 0,-800" begin="3s" dur="7s" fill="freeze" repeatCount="indefinite" /> 103 103 </g> … … 106 106 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 107 107 </g> 108 <animateTransform attributeName="transform" type="translate" 108 <animateTransform attributeName="transform" type="translate" additive="sum" 109 109 values="0,0; 0,-800" begin="5s" dur="9s" fill="freeze" repeatCount="indefinite" /> 110 110 </g> … … 113 113 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 114 114 </g> 115 <animateTransform attributeName="transform" type="translate" 115 <animateTransform attributeName="transform" type="translate" additive="sum" 116 116 values="0,0; 0,-800" begin="2s" dur="6s" fill="freeze" repeatCount="indefinite" /> 117 117 </g> … … 120 120 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 121 121 </g> 122 <animateTransform attributeName="transform" type="translate" 122 <animateTransform attributeName="transform" type="translate" additive="sum" 123 123 values="0,0; 0,-800" begin="4s" dur="8s" fill="freeze" repeatCount="indefinite" /> 124 124 </g> … … 127 127 <use xlink:href="#bubble" fill="url(#redBubble)" /> 128 128 </g> 129 <animateTransform attributeName="transform" type="translate" 129 <animateTransform attributeName="transform" type="translate" additive="sum" 130 130 values="0,0; 0,-800" begin="1s" dur="4s" fill="freeze" repeatCount="indefinite" /> 131 131 </g> … … 134 134 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 135 135 </g> 136 <animateTransform attributeName="transform" type="translate" 136 <animateTransform attributeName="transform" type="translate" additive="sum" 137 137 values="0,0; 0,-800" begin="0s" dur="11s" fill="freeze" repeatCount="indefinite" /> 138 138 </g> … … 141 141 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 142 142 </g> 143 <animateTransform attributeName="transform" type="translate" 143 <animateTransform attributeName="transform" type="translate" additive="sum" 144 144 values="0,0; 0,-800" begin="3s" dur="7.5s" fill="freeze" repeatCount="indefinite" /> 145 145 </g> … … 149 149 <use xlink:href="#bubble" fill="url(#blueBubble)" /> 150 150 </g> 151 <animateTransform attributeName="transform" type="translate" 151 <animateTransform attributeName="transform" type="translate" additive="sum" 152 152 values="0,0; 0,-800" begin="3s" dur="6s" fill="freeze" repeatCount="indefinite" /> 153 153 </g> … … 156 156 <use xlink:href="#bubble" fill="url(#redBubble)" /> 157 157 </g> 158 <animateTransform attributeName="transform" type="translate" 158 <animateTransform attributeName="transform" type="translate" additive="sum" 159 159 values="0,0; 0,-800" begin="5.5s" dur="7s" fill="freeze" repeatCount="indefinite" /> 160 160 </g> … … 163 163 <use xlink:href="#bubble" fill="url(#greenBubble)" /> 164 164 </g> 165 <animateTransform attributeName="transform" type="translate" 165 <animateTransform attributeName="transform" type="translate" additive="sum" 166 166 values="0,0; 0,-800" begin="1s" dur="9s" fill="freeze" repeatCount="indefinite" /> 167 167 </g> … … 170 170 <use xlink:href="#bubble" fill="url(#yellowBubble)" /> 171 171 </g> 172 <animateTransform attributeName="transform" type="translate" 172 <animateTransform attributeName="transform" type="translate" additive="sum" 173 173 values="0,0; 0,-800" begin="2s" dur="9.5s" fill="freeze" repeatCount="indefinite" /> 174 174 </g> … … 187 187 <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10 188 188 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" 190 190 begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" /> 191 191 </g> -
trunk/examples/opengl/pbuffers2/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 137 137 138 138 // save the GL state set for QPainter 139 p.beginNativePainting(); 139 140 saveGLState(); 140 141 … … 207 208 // restore the GL state that QPainter expects 208 209 restoreGLState(); 210 p.endNativePainting(); 209 211 210 212 // draw the overlayed text using QPainter -
trunk/examples/opengl/pbuffers2/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/pbuffers2/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/pbuffers2/pbuffers2.pro
r2 r561 20 20 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers2 21 21 INSTALLS += target sources 22 23 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/samplebuffers/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 107 107 void GLWidget::makeObject() 108 108 { 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)); 110 110 const double Pi = 3.14159265358979323846; 111 111 const int NumSectors = 15; … … 135 135 GLdouble y8 = 0.30 * cos(angle2); 136 136 137 qglColor( trolltechGreen);137 qglColor(qtGreen); 138 138 quad(GL_QUADS, x5, y5, x6, y6, x7, y7, x8, y8); 139 139 qglColor(Qt::black); … … 141 141 } 142 142 143 qglColor( trolltechGreen);143 qglColor(qtGreen); 144 144 quad(GL_QUADS, x1, y1, x2, y2, y2, x2, y1, x1); 145 145 quad(GL_QUADS, x3, y3, x4, y4, y4, x4, y3, x3); -
trunk/examples/opengl/samplebuffers/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/samplebuffers/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/samplebuffers/samplebuffers.pro
r2 r561 9 9 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/samplebuffers 10 10 INSTALLS += target sources 11 12 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/textures/glwidget.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 43 43 #include <QtOpenGL> 44 44 45 #include <math.h>46 47 45 #include "glwidget.h" 48 49 GLuint GLWidget::sharedObject = 0;50 int GLWidget::refCount = 0;51 46 52 47 GLWidget::GLWidget(QWidget *parent, QGLWidget *shareWidget) … … 57 52 yRot = 0; 58 53 zRot = 0; 54 #ifdef QT_OPENGL_ES_2 55 program = 0; 56 #endif 59 57 } 60 58 61 59 GLWidget::~GLWidget() 62 60 { 63 if (--refCount == 0) {64 makeCurrent();65 glDeleteLists(sharedObject, 1);66 }67 61 } 68 62 … … 93 87 void GLWidget::initializeGL() 94 88 { 95 if (!sharedObject) 96 sharedObject = makeObject(); 97 ++refCount; 89 makeObject(); 98 90 99 91 glEnable(GL_DEPTH_TEST); 100 92 glEnable(GL_CULL_FACE); 93 #ifndef QT_OPENGL_ES_2 101 94 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 102 136 } 103 137 … … 106 140 qglClearColor(clearColor); 107 141 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 142 143 #if !defined(QT_OPENGL_ES_2) 144 108 145 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 } 114 179 } 115 180 … … 119 184 glViewport((width - side) / 2, (height - side) / 2, side, side); 120 185 186 #if !defined(QT_OPENGL_ES_2) 121 187 glMatrixMode(GL_PROJECTION); 122 188 glLoadIdentity(); 189 #ifndef QT_OPENGL_ES 123 190 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 124 194 glMatrixMode(GL_MODELVIEW); 195 #endif 125 196 } 126 197 … … 148 219 } 149 220 150 GLuintGLWidget::makeObject()221 void GLWidget::makeObject() 151 222 { 152 223 static const int coords[6][4][3] = { … … 159 230 }; 160 231 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 169 237 for (int i = 0; i < 6; ++i) { 170 glBindTexture(GL_TEXTURE_2D, textures[i]);171 glBegin(GL_QUADS);172 238 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])); 176 244 } 177 glEnd(); 178 } 179 180 glEndList(); 181 return list; 182 } 245 } 246 } -
trunk/examples/opengl/textures/glwidget.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 43 43 #define GLWIDGET_H 44 44 45 #include <QtGui> 45 46 #include <QGLWidget> 47 48 class QGLShaderProgram; 46 49 47 50 class GLWidget : public QGLWidget … … 70 73 71 74 private: 72 GLuintmakeObject();75 void makeObject(); 73 76 74 77 QColor clearColor; … … 77 80 int yRot; 78 81 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 82 88 }; 83 89 -
trunk/examples/opengl/textures/main.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/examples/opengl/textures/textures.pro
r2 r561 12 12 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures 13 13 INSTALLS += target sources 14 15 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -
trunk/examples/opengl/textures/window.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 49 49 QGridLayout *mainLayout = new QGridLayout; 50 50 51 glWidgets[0][0] = 0;52 53 51 for (int i = 0; i < NumRows; ++i) { 54 52 for (int j = 0; j < NumColumns; ++j) { … … 58 56 255, 63); 59 57 60 glWidgets[i][j] = new GLWidget(0, glWidgets[0][0]);58 glWidgets[i][j] = new GLWidget(0, 0); 61 59 glWidgets[i][j]->setClearColor(clearColor); 62 60 glWidgets[i][j]->rotateBy(+42 * 16, +42 * 16, -21 * 16); -
trunk/examples/opengl/textures/window.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 **
Note:
See TracChangeset
for help on using the changeset viewer.