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  · 

Qt3D Module

Overview

What is Qt 3D?

The Qt 3D module provides a set of APIs to make 3D graphics programming easy and declarative. Seamless integration with the Qt Quick module allows for developers to add 3D contents to any Qt application in the same way icons and pixmaps are used in a regular Qt application. At the same time, Qt 3D is powerful enough for creating full scale 3D applications or games. To guarantee the graphics performance on various platforms, Qt 3D is hardware accelerated using GPU. For more direct and low-level access to 3D graphics hardware, please see OpenGL ES APIs.

Common Use Cases

  • Adding 3D models to 2D applications - Qt 3D's ViewPort item that defines the logical viewport for a 3D scene can be placed in any 2D application. For example, it is possible to place a 3D avatar on a 2D contacts application.
  • 3D User Interface Elements - Qt 3D handles external inputs such as touch or key events so that it is possible to interact with any Qt 3D items on the screen.
  • 3D Visualizations in media player - Qt 3D's QML API supports regular QML features such as property bindings and QML animation framework. Therefore, developers can create a 3D visualization application with less code.
  • Casual games - Combining Qt 3D features with other Qt modules such as Qt Sensors allows developers to create interactive 3D games easily.

C++ and QML APIs

Qt 3D consists of two libraries which support the same features in C++ interface and QML respectively. Both libraries share the same primary goal which is to make the 3D graphics programming easy. Qt 3D's C++ API is originally developed to make the OpenGL programming as cross-platform as possible. Traditionally porting between desktop and embedded OpenGL variants has been difficult due to differing function names, as well as a shader-based versus fixed function rendering pipeline. The C++ API for Qt3D eases this difficulty by abstracting these differences away beneath a Qt like API layer. The QML bindings for Qt 3D takes this further and make the 3D programming declarative.

To use the C++ library in your application, add the following configuration option to your .pro file.

 QT += 3d

To use Qt 3D in your QML application you need the following import statement in your qml file.

 import Qt3D 1.0

Asset loading, built-in shapes, shaders and texture management are the main features and they are explained below in details. Developers may choose a suitable interface depending on requirements or preference.

Asset Loading

Using Qt 3D it is easy to load 3D content from a standard interchange file format into your application. Currently supported formats are:

Developed byFile ExtensionDescription
Waterfront Technologies.objOriginally developed for Advanced Visualizer by Waterfront Technologies. The OBJ file format that represents 3D geometry is open and widely adopted.
Autodesk.3dsFormat used in 3D Studio MAX. This format is popular among video game developers.
COLLADA.daeCOLLADA(COLLAborative Design Activity) is managed by Khronos Group.
id Software.MD2Format used by Quake II and many other games.
Inivis.acPopular format for games and simulations.
N/A.bezBezier Surface File specifices collection of bezier patches.

A QML Example that loads a teapot shaped 3D model:

 import QtQuick 2.0
 import Qt3D 1.0

 Viewport {
     width: 640; height: 480
     Item3D {
         id: teapot
         mesh: Mesh { source: "teapot.bez" }
         effect: Effect {}
     }
 }

Built-in Shapes

Qt 3D comes with a number of built-in primitive shapes. To use these shapes in your application you need the following import statement in your QML application.

 import Qt3D.Shapes 1.0

Shader and Textures

Both external 3D models and built-in shapes can be decorated using ShaderProgram and Effect element. The ShaderProgram item is derivative class of the more general Effect class in QML Qt 3D. Whereas the Effect class provides support for standard effects under OpenGL, the ShaderProgram supports effects based on custom shader programs for the GPU.

3D Asset Viewer

Qt 3D comes with a 3D Asset Viewer application which helps the developer to visually scale, rotate, and position a 3D model before adding it to a viewport. The application can then auto create a QML file that can later be used as a component in a QML application. 3D Asset Viewer is launched from Qt Creator as an external application by clicking Tools and External options from the menu tab.

Getting Started

Qt3D Core Concepts

API Reference documentation

Extending Qt 3D

Adding new 3D file format - Qt 3D has a plugin based system so that new format can be supported easily.

Physics Integration - Physics integration is not officially supported yet, but you can integrate the commonly used Bullet physics engine with C++ Qt3D.

Future Roadmap & Contributions

Please visit Qt bugreports system, JIRA, to see our future roadmap.

For more information on contributions please visit the Qt3D contributions page.

We would like to hear your feedback and accept any contributions in forms of code, documentation, examples and bugs reports. Please contact us on the Qt3D mailing list.

See Other Licenses Used in Qt 3D for details of Qt 3D licensing, and also of 3rd party code used in Qt 3D, including acknowledgements.

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