Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Qt for Windows CE and OpenGL ES

Introduction

OpenGL 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. OpenGL ES is a subset of the OpenGL standard. Because it is designed for use with embedded systems, it has a smaller, more constrained API.

OpenGL ES version 1.x is designed for fixed function hardware, while its successor OpenGL ES version 2.x 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 OpenGL ES Shading Language (GLSL ES). Instead of using the pre-defined functions, the programmer writes small shader programs telling the hardware in detail how to render each object.

The QtOpenGL module 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 1.x and 2.x with Qt for Embedded. However, Qt for Embedded can be adapted to a wide range of OpenGL versions.

To translate QPainter 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 QPaintEngine. 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.

Using OpenGL ES with Qt

To use OpenGL-enabled widgets in a Qt for Embedded application, all that is required is to subclass QGLWidget and draw into instances of the subclass with standard OpenGL functions. The current implementation only supports OpenGL ES and 2D painting within a QGLWidget. 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.

Note: The OpenGL paint engine is not currently supported in regular widgets. However, any application that uses QGraphicsView can set a QGLWidget as the viewport and obtain access to the OpenGL paint engine that way:

 QGraphicsView view(&scene);
 view.setViewport(new QGLWidget());
 view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
 view.setFrameStyle(0);
 view.showFullScreen();

It is recommended that the QGraphicsView::FullViewportUpdate flag be set because the default double-buffered behavior of QGLWidget 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.

Once a QGraphicsView has been initialized as above, regular widgets can be added to the canvas using QGraphicsProxyWidget if the application requires them.

Note: OpenGL ES 2.X does not support PBuffers, so QGLPixelBuffer will not work. In this case, QGLFramebufferObject 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 QGLPixelBuffer.

Note: On most embedded hardware, the OpenGL implementation is actually OpenGL/ES 1.1 or OpenGL/ES 2.0. When painting within a QGLWidget::paintGL() override, it is necessary to limit the application to only the features that are present in the OpenGL/ES implementation.

Using OpenGL with Qt for Windows CE

Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the Windows CE window manager.

Configure

To configure Qt for Windows Mobile 5.0 and OpenGL ES Common support you can run configure like this:

 configure -platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005 -opengl-es-cm

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.

You can run configure with the -opengl-es-cm option for the Common profile. Ensure that the lib and includes paths include the OpenGL ES headers and libararies from your SDK. The OpenGL ES lib should be called either libGLES_CM.lib for the Common profile.

To start programming with Qt and OpenGL ES on Windows CE, you can start with the Hello GL ES Example. This example shows how to use QGLWidget and QGLPainter with OpenGL ES. It also provides some hints on how to port OpenGL code to OpenGL ES.

Using OpenGL to Accelerate Normal 2D Painting

Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates QPainter operations into OpenGL calls. This is especially convenient for drawing text or QImage objects in an OpenGL ES context. For further details, refer to the Hello GL ES Example.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web