<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- wince-opengl.qdoc --> <title>Qt 4.8: Qt for Windows CE and OpenGL ES</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li>Qt for Windows CE and OpenGL ES</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#introduction">Introduction</a></li> <li class="level1"><a href="#using-opengl-es-with-qt">Using OpenGL ES with Qt</a></li> <li class="level1"><a href="#using-opengl-with-qt-for-windows-ce">Using OpenGL with Qt for Windows CE</a></li> <li class="level2"><a href="#configure">Configure</a></li> <li class="level2"><a href="#using-opengl-to-accelerate-normal-2d-painting">Using OpenGL to Accelerate Normal 2D Painting</a></li> </ul> </div> <h1 class="title">Qt for Windows CE and OpenGL ES</h1> <span class="subtitle"></span> <!-- $$$windowsce-opengl.html-description --> <div class="descr"> <a name="details"></a> <a name="introduction"></a> <h2>Introduction</h2> <p><a href="http://www.opengl.org">OpenGL</a> is an industry standard API for 2D/3D graphics. It provides a powerful, low-level interface between software and acceleration hardware, and it is operating system and window system independent. <a href="http://www.khronos.org/opengles">OpenGL ES</a> is a subset of the <a href="http://www.opengl.org">OpenGL</a> standard. Because it is designed for use with embedded systems, it has a smaller, more constrained API.</p> <p><a href="http://www.khronos.org/opengles/1_X">OpenGL ES version 1.x</a> is designed for fixed function hardware, while its successor <a href="http://www.khronos.org/opengles/2_X">OpenGL ES version 2.x</a> is designed for programmable hardware. It is worth noting that there is a significant difference between the two, and that they are not compatible with each other. OpenGL ES 1.x limits processing to a pre-defined set of fixed options for drawing and lighting objects. OpenGL 2.x has a significantly shorter graphics pipeline than 1.x. Instead of using function transformation and a fragment pipeline, 2.x uses the <a href="http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf">OpenGL ES Shading Language (GLSL ES)</a>. Instead of using the pre-defined functions, the programmer writes small shader programs telling the hardware in detail how to render each object.</p> <p>The <a href="qtopengl.html">QtOpenGL module</a> offers classes that make it easy to draw 3D graphics in GUI applications using OpenGL ES. Qt provides a plugin that integrates both OpenGL ES versions <a href="http://www.khronos.org/opengles/1_X">1.x</a> and <a href="http://www.khronos.org/opengles/2_X">2.x</a> with Qt for Embedded. However, Qt for Embedded can be adapted to a wide range of OpenGL versions.</p> <p>To translate <a href="qpainter.html">QPainter</a> operations into OpenGL ES calls (there are actually two subclasses, one for OpenGL/ES 1.1 and another for OpenGL/ES 2.0), Qt uses a subclass of <a href="qpaintengine.html">QPaintEngine</a>. This specialized paint engine can be used to improve 2D rendering performance on appropriate hardware. It can also overlay controls and decorations onto 3D scenes drawn using OpenGL.</p> <a name="using-opengl-es-with-qt"></a> <h2>Using OpenGL ES with Qt</h2> <p>To use OpenGL-enabled widgets in a Qt for Embedded application, all that is required is to subclass <a href="qglwidget.html">QGLWidget</a> and draw into instances of the subclass with standard OpenGL functions. The current implementation only supports OpenGL ES and 2D painting within a <a href="qglwidget.html">QGLWidget</a>. Using OpenGL ES to accelerate regular widgets as well as compositing top-level windows with OpenGL ES are not currently supported. These issues will be addressed in future versions of Qt.</p> <p><b>Note:</b> The OpenGL paint engine is not currently supported in regular widgets. However, any application that uses <a href="qgraphicsview.html">QGraphicsView</a> can set a <a href="qglwidget.html">QGLWidget</a> as the viewport and obtain access to the OpenGL paint engine that way:</p> <pre class="cpp"> <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span> view(<span class="operator">&</span>scene); view<span class="operator">.</span>setViewport(<span class="keyword">new</span> <span class="type"><a href="qglwidget.html">QGLWidget</a></span>()); view<span class="operator">.</span>setHorizontalScrollBarPolicy(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>ScrollBarAlwaysOff); view<span class="operator">.</span>setVerticalScrollBarPolicy(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>ScrollBarAlwaysOff); view<span class="operator">.</span>setViewportUpdateMode(<span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span><span class="operator">::</span>FullViewportUpdate); view<span class="operator">.</span>setFrameStyle(<span class="number">0</span>); view<span class="operator">.</span>showFullScreen();</pre> <p>It is recommended that the <a href="qgraphicsview.html#ViewportUpdateMode-enum">QGraphicsView::FullViewportUpdate</a> flag be set because the default double-buffered behavior of <a href="qglwidget.html">QGLWidget</a> does not support partial updates. It is also recommended that the window be shown full-screen because that usually has the best performance on current OpenGL ES implementations.</p> <p>Once a <a href="qgraphicsview.html">QGraphicsView</a> has been initialized as above, regular widgets can be added to the canvas using <a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a> if the application requires them.</p> <p><b>Note:</b> OpenGL ES 2.X does not support PBuffers, so <a href="qglpixelbuffer.html">QGLPixelBuffer</a> will not work. In this case, <a href="qglframebufferobject.html">QGLFramebufferObject</a> should be used instead. However, OpenGL ES 1.X does not support Framebuffer objects, with the exception of some OpenGL ES 1.X extensions. In this case, please use <a href="qglpixelbuffer.html">QGLPixelBuffer</a>.</p> <p><b>Note:</b> On most embedded hardware, the OpenGL implementation is actually <a href="http://www.khronos.org/opengles/1_X/">OpenGL/ES 1.1</a> or <a href="http://www.khronos.org/opengles/2_X/">OpenGL/ES 2.0</a>. When painting within a <a href="qglwidget.html#paintGL">QGLWidget::paintGL</a>() override, it is necessary to limit the application to only the features that are present in the OpenGL/ES implementation.</p> <a name="using-opengl-with-qt-for-windows-ce"></a> <h2>Using OpenGL with Qt for Windows CE</h2> <p>Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the Windows CE window manager.</p> <a name="configure"></a> <h3>Configure</h3> <p>To configure Qt for Windows Mobile 5.0 and OpenGL ES Common support you can run <tt>configure</tt> like this:</p> <pre class="cpp"> configure -platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005 -opengl-es-cm</pre> <p>OpenGL ES includes profiles for floating-point and fixed-point arithmetic. The floating point profile is called OpenGL ES CM (Common) and the fixed-point profile is called OpenGL ES CL (Common Lite). The fixed-point profile is no longer supported since Qt 4.7.</p> <p>You can run <tt>configure</tt> with the <tt>-opengl-es-cm</tt> option for the Common profile. Ensure that the <tt>lib</tt> and <tt>includes</tt> paths include the OpenGL ES headers and libararies from your SDK. The OpenGL ES lib should be called either <tt>libGLES_CM.lib</tt> for the Common profile.</p> <p>To start programming with Qt and OpenGL ES on Windows CE, you can start with the <a href="opengl-hellogl-es.html">Hello GL ES Example</a>. This example shows how to use <a href="qglwidget.html">QGLWidget</a> and QGLPainter with OpenGL ES. It also provides some hints on how to port OpenGL code to OpenGL ES.</p> <a name="using-opengl-to-accelerate-normal-2d-painting"></a> <h3>Using OpenGL to Accelerate Normal 2D Painting</h3> <p>Qt provides QOpenGLPaintEngine, a subclass of <a href="qpaintengine.html">QPaintEngine</a> that translates <a href="qpainter.html">QPainter</a> operations into OpenGL calls. This is especially convenient for drawing text or <a href="qimage.html">QImage</a> objects in an OpenGL ES context. For further details, refer to the <a href="opengl-hellogl-es.html">Hello GL ES Example</a>.</p> </div> <!-- @@@windowsce-opengl.html --> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>