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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Qt for Embedded Linux and OpenGL

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 meant for use in embedded systems, it has a smaller, more constrained API.

For reference, Nokia provides a plugin which integrates OpenGL ES with Qt for Embedded Linux, but Qt for Embedded Linux can be adapted to a wide range of OpenGL versions.

There are three ways to use OpenGL with Qt for Embedded Linux:

  • Perform OpenGL 3D graphics operations in applications;
  • Accelerate normal 2D painting operations;
  • Implement window compositing and special effects.

Qt for Embedded Linux is shipped with a reference integration example that demonstrates all three uses.

Using OpenGL 3D Graphics in Applications

The QtOpenGL module offers classes that make it easy to draw 3D graphics in GUI applications. The module API is cross-platform, so it is also available on Windows, X11, and Mac OS X.

To use OpenGL-enabled widgets in a Qt for Embedded Linux application, all that is required is to subclass the QGLWidget and draw into instances of the subclass with standard OpenGL functions.

Using OpenGL to Accelerate Normal 2D Painting

Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates QPainter operations into OpenGL calls. 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 to Implement Window Compositing and Effects

Qt for Embedded Linux includes a complete windowing system, which implements real transparency. The windowing system can be accelerated using OpenGL to implement top level window compositing. This makes it easy to add 3D effects to applications, for instance when windows are minimized or maximized.

Acceleration Architecture

The diagram below shows the Qt for Embedded Linux painting architecture.

A client process widget uses a paint engine to draw into a window surface. The server then combines the window surfaces and displays the composition on the screen. This architecture lets you control the steps of the painting process by subclassing.

Subclassing QPaintEngine allows you to implement the QPainter API using accelerated hardware. Subclassing QWindowSurface lets you decide the properties of the space your widgets will draw themselves into, as well as which paint engine they should use to draw themselves into that space. Subclassing QScreen lets you control the creation of window surfaces and lets you decide how to implement window compositing. Using subclassing, your implementation work is minimized since you can reuse base class functionality you don't need to change.

The elements of an accelerated Qt for Embedded Linux system are shown in the diagram below.

The applications, using the Qt API, do not depend on the presence of the acceleration plugin. The plugin uses the graphics hardware to accelerate painting primitives. Any operations not accelerated by the plugin are done in software by the software paint engine.

To integrate an OpenGL implementation into Qt for Embedded Linux for a particular platform, you use the same mechanisms you would use for writing any other accelerated driver. Base classes, e.g., QGLScreen and QWSGLWindowSurface, are provided to minimize the need for reimplementing common functionality.

The Reference Integration

The OpenGL for Embedded Systems Example is the reference implementation for integrating OpenGL ES and EGL with the graphics acceleration architecture of Qt for Embedded Linux. (EGL is a library that binds OpenGL ES to native windowing systems.)

The diagram below shows how OpenGL ES is used within the acceleration architecture:

The example implements a screen driver plugin that demonstrates all three uses of OpenGL in Qt for Embedded Linux: 2D graphics acceleration, 3D graphics operations using the QtOpenGL module, and top-level window compositing and special effects. The applications still do not talk directly to the accelerated plugin.

For 2D graphics, applications use the normal Qt painting API. The example accelerates 2D painting by using the QOpenGLPaintEngine, which is included in the QtOpenGL module.

For 3D graphics applications use the OpenGL API directly, together with the functionality in the Qt OpenGL support classes. The example supports this by creating a QWSGLWindowSurface whenever a QGLWidget is instantiated.

All access to the display is done through OpenGL. The example subclasses QWSGLWindowSurface implementation and uses the OpenGL Framebuffer Object extension to draw windows into an offscreen buffer. This lets the example use OpenGL to implement top level window compositing of opaque and semi-transparent windows, and to provide a 3D animated transition effect as each new window is shown.

The specific OpenGL library being used by the example restricts all OpenGL operations to occur in a single process. Hence the example creates instances of QWSGLWindowSurface only in the server process. Other processes then perform 2D graphics by creating instances of the standard QWindowSurface classes for client processes. The standard window surface performs software-based rendering into a shared memory segment. The server then transfers the contents of this shared memory into an OpenGL texture before they are drawn onto the screen during window compositing.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 54
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Quarterly au hasard

Logo

Implémenter un mutex en lecture et en écriture

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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 qtextended4.4
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