Qt3D ModuleOverviewWhat 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
C++ and QML APIsQt 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 LoadingUsing Qt 3D it is easy to load 3D content from a standard interchange file format into your application. Currently supported formats are:
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 ShapesQt 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 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. 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. 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. 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. |