The rest of the class contains utility functions and variables that are used to construct and hold orientation information for the scene. The logo variable will be used to hold a pointer to the QtLogo object which contains all the geometry.
OpenGL initialization, viewport resizing, and painting are handled by reimplementing the (), (), and () handler functions. To enable the user to interact directly with the scene using the mouse, we reimplement () and ().
The signals and slots are used to allow other objects to interact with the 3D scene.
We use a destructor to ensure that any OpenGL-specific data structures are deleted when the widget is no longer needed (although in this case nothing needs cleaning up).
The GLWidget class contains some standard public definitions for the constructor, destructor, , and functions:
Qt provides the class to enable OpenGL graphics to be rendered within a standard application user interface. By subclassing this class, and providing reimplementations of event handler functions, 3D scenes can be displayed on widgets that can be placed in layouts, connected to other objects using signals and slots, and manipulated like any other widget.
The Hello GL example demonstrates the basic use of the OpenGL-related classes provided with Qt.
Qt 4.7: Пример Hello GL | Документация
Комментариев нет:
Отправить комментарий