Fix example documentation for OpenGL module and (widget) Tools.
Change-Id: Id9dc39752bcae915f618e1a5696115a5e6923251 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
af385b3bc6
commit
be7ebe2d57
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example 2dpainting
|
\example 2dpainting
|
||||||
\title 2D Painting Example
|
\title 2D Painting Example
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
|
|
||||||
\brief The 2D Painting example shows how QPainter and QGLWidget can be used
|
\brief The 2D Painting example shows how QPainter and QGLWidget can be used
|
||||||
together to display accelerated 2D graphics on supported hardware.
|
together to display accelerated 2D graphics on supported hardware.
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example cube
|
\example cube
|
||||||
\group all-examples
|
\ingroup examples-widgets-opengl
|
||||||
\title Cube OpenGL ES 2.0 example
|
\title Cube OpenGL ES 2.0 example
|
||||||
|
|
||||||
\brief The Cube OpenGL ES 2.0 example shows how to write mouse rotateable
|
\brief The Cube OpenGL ES 2.0 example shows how to write mouse rotateable
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
\example framebufferobject2
|
\example framebufferobject2
|
||||||
\title Framebuffer Object 2 Example
|
\title Framebuffer Object 2 Example
|
||||||
|
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
\brief The Framebuffer Object 2 example demonstrates how to use the
|
\brief The Framebuffer Object 2 example demonstrates how to use the
|
||||||
QGLFramebufferObject class to render into an off-screen buffer and
|
QGLFramebufferObject class to render into an off-screen buffer and
|
||||||
use the contents as a texture in a QGLWidget.
|
use the contents as a texture in a QGLWidget.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example grabber
|
\example grabber
|
||||||
\title Grabber Example
|
\title Grabber Example
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
|
|
||||||
\brief The Grabber examples shows how to retrieve the contents of an OpenGL framebuffer.
|
\brief The Grabber examples shows how to retrieve the contents of an OpenGL framebuffer.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example hellogl
|
\example hellogl
|
||||||
\title Hello GL Example
|
\title Hello GL Example
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
|
|
||||||
\brief The Hello GL example demonstrates the basic use of the OpenGL-related classes
|
\brief The Hello GL example demonstrates the basic use of the OpenGL-related classes
|
||||||
provided with Qt.
|
provided with Qt.
|
||||||
|
@ -1,128 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:FDL$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Free Documentation License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Free
|
|
||||||
** Documentation License version 1.3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file included in the packaging of
|
|
||||||
** this file. Please review the following information to ensure
|
|
||||||
** the GNU Free Documentation License version 1.3 requirements
|
|
||||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\example hellogl_es
|
|
||||||
\title Hello GL ES Example
|
|
||||||
|
|
||||||
\brief The Hello GL ES example is the \l{Hello GL Example} ported to OpenGL ES.
|
|
||||||
It also included some effects from the OpenGL \l{Overpainting Example}.
|
|
||||||
|
|
||||||
\image hellogl-es-example.png
|
|
||||||
|
|
||||||
A complete introduction to OpenGL ES and a description of all differences
|
|
||||||
between OpenGL and OpenGL ES is out of the scope of this document; but
|
|
||||||
we will describe some of the major issues and differences.
|
|
||||||
|
|
||||||
Since Hello GL ES is a direct port of standard OpenGL code, it is a fairly
|
|
||||||
good example for porting OpenGL code to OpenGL ES.
|
|
||||||
|
|
||||||
\tableofcontents
|
|
||||||
|
|
||||||
\section1 Using QGLWidget
|
|
||||||
|
|
||||||
QGLWidget can be used for OpenGL ES similar to the way it is used with
|
|
||||||
standard OpenGL; but there are some differences. We use EGL 1.0 to embedd
|
|
||||||
the OpenGL ES window within the native window manager. In
|
|
||||||
QGLWidget::initializeGL() we initialize OpenGL ES.
|
|
||||||
|
|
||||||
\section1 Porting OpenGL to OpenGL ES
|
|
||||||
|
|
||||||
Since OpenGL ES is missing the immediate mode and does not support quads,
|
|
||||||
we have to create triangle arrays.
|
|
||||||
|
|
||||||
We create a quad by adding vertices to a QList of vertices. We create both
|
|
||||||
sides of the quad and hardcode a distance of 0.05f. We also compute the
|
|
||||||
correct normal for each face and store them in another QList.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 0
|
|
||||||
|
|
||||||
And then we convert the complete list of vertexes and the list of normals
|
|
||||||
into the native OpenGL ES format that we can use with the OpenGL ES API.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 1
|
|
||||||
|
|
||||||
In \c paintQtLogo() we draw the triangle array using OpenGL ES. We use
|
|
||||||
q_vertexTypeEnum to abstract the fact that our vertex and normal arrays
|
|
||||||
are either in float or in fixed point format.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 2
|
|
||||||
|
|
||||||
\section1 Using QGLPainter
|
|
||||||
|
|
||||||
Since the \c QGLPainter is slower for OpenGL ES we paint the bubbles with
|
|
||||||
the rasterizer and cache them in a QImage. This happends only once during
|
|
||||||
the initialiazation.
|
|
||||||
|
|
||||||
\snippet hellogl_es/bubble.cpp 0
|
|
||||||
|
|
||||||
For each bubble this QImage is then drawn to the QGLWidget by using the
|
|
||||||
according QPainter with transparency enabled.
|
|
||||||
|
|
||||||
\snippet hellogl_es/bubble.cpp 1
|
|
||||||
|
|
||||||
Another difference beetwen OpenGL and OpenGL ES is that OpenGL ES does not
|
|
||||||
support glPushAttrib(GL_ALL_ATTRIB_BITS). So we have to restore all the
|
|
||||||
OpenGL states ourselves, after we created the QPainter in
|
|
||||||
GLWidget::paintGL().
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 3
|
|
||||||
|
|
||||||
Setting up up the model view matrix and setting the right OpenGL states is
|
|
||||||
done in the same way as for standard OpenGL.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 4
|
|
||||||
|
|
||||||
Now we have to restore the OpenGL state for the QPainter. This is not done
|
|
||||||
automatically for OpenGL ES.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 5
|
|
||||||
|
|
||||||
Now we use the QPainter to draw the transparent bubbles.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 6
|
|
||||||
|
|
||||||
In the end, we calculate the framerate and display it using the QPainter
|
|
||||||
again.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 7
|
|
||||||
|
|
||||||
After we finished all the drawing operations we swap the screen buffer.
|
|
||||||
|
|
||||||
\snippet hellogl_es/glwidget.cpp 8
|
|
||||||
|
|
||||||
\section1 Summary
|
|
||||||
|
|
||||||
Similar to the \l{Hello GL Example}, we subclass QGLWidget to render
|
|
||||||
a 3D scene using OpenGL ES calls. QGLWidget is a subclass of QWidget.
|
|
||||||
Hence, its \l{QGLWidget}'s subclasses can be placed in layouts and
|
|
||||||
provided with interactive features just like normal custom widgets.
|
|
||||||
|
|
||||||
QGLWidget allows pure OpenGL ES rendering to be mixed with QPainter calls,
|
|
||||||
but care must be taken to maintain the state of the OpenGL ES
|
|
||||||
implementation.
|
|
||||||
*/
|
|
@ -29,6 +29,7 @@
|
|||||||
\example overpainting
|
\example overpainting
|
||||||
\title Overpainting Example
|
\title Overpainting Example
|
||||||
|
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
\brief The Overpainting example shows how QPainter can be used
|
\brief The Overpainting example shows how QPainter can be used
|
||||||
to overpaint a scene rendered using OpenGL in a QGLWidget.
|
to overpaint a scene rendered using OpenGL in a QGLWidget.
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
\example pbuffers
|
\example pbuffers
|
||||||
\title Pixel Buffers Example
|
\title Pixel Buffers Example
|
||||||
|
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
\brief The Pixel Buffers example demonstrates how to use the
|
\brief The Pixel Buffers example demonstrates how to use the
|
||||||
QGLPixelBuffer class to render into an off-screen buffer and use
|
QGLPixelBuffer class to render into an off-screen buffer and use
|
||||||
the contents as a dynamic texture in a QGLWidget.
|
the contents as a dynamic texture in a QGLWidget.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
\example pbuffers2
|
\example pbuffers2
|
||||||
\title Pixel Buffers 2 Example
|
\title Pixel Buffers 2 Example
|
||||||
|
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
\brief The Pixel Buffers 2 example demonstrates how to use the
|
\brief The Pixel Buffers 2 example demonstrates how to use the
|
||||||
QGLPixelBuffer class to render into an off-screen buffer and use
|
QGLPixelBuffer class to render into an off-screen buffer and use
|
||||||
the contents as a dynamic texture in a QGLWidget.
|
the contents as a dynamic texture in a QGLWidget.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
\example samplebuffers
|
\example samplebuffers
|
||||||
\title Sample Buffers Example
|
\title Sample Buffers Example
|
||||||
|
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
\brief The Sample Buffers example demonstrates how to use and enable
|
\brief The Sample Buffers example demonstrates how to use and enable
|
||||||
sample buffers in a QGLWidget.
|
sample buffers in a QGLWidget.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example textures
|
\example textures
|
||||||
\title Textures Example
|
\title Textures Example
|
||||||
|
\ingroup examples-widgets-opengl
|
||||||
|
|
||||||
\brief The Textures example demonstrates the use of Qt's image classes as textures in
|
\brief The Textures example demonstrates the use of Qt's image classes as textures in
|
||||||
applications that use both OpenGL and Qt to display graphics.
|
applications that use both OpenGL and Qt to display graphics.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/completer
|
\example tools/completer
|
||||||
\title Completer Example
|
\title Completer Example
|
||||||
|
\ingroup example-widgets-tools
|
||||||
|
|
||||||
\brief The Completer example shows how to provide string-completion facilities
|
\brief The Completer example shows how to provide string-completion facilities
|
||||||
for an input widget based on data provided by a model.
|
for an input widget based on data provided by a model.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/echoplugin
|
\example tools/echoplugin
|
||||||
\title Echo Plugin Example
|
\title Echo Plugin Example
|
||||||
|
\group examples-widgets-tools
|
||||||
|
|
||||||
\brief This example shows how to create a Qt plugin.
|
\brief This example shows how to create a Qt plugin.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/i18n
|
\example tools/i18n
|
||||||
\title I18N Example
|
\title I18N Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief The Internationalization (I18N) example demonstrates Qt's support for translated
|
\brief The Internationalization (I18N) example demonstrates Qt's support for translated
|
||||||
text. Developers can write the initial application text in one language, and
|
text. Developers can write the initial application text in one language, and
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/plugandpaint
|
\example tools/plugandpaint
|
||||||
\title Plug & Paint Example
|
\title Plug & Paint Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief The Plug & Paint example demonstrates how to write Qt
|
\brief The Plug & Paint example demonstrates how to write Qt
|
||||||
applications that can be extended through plugins.
|
applications that can be extended through plugins.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/regexp
|
\example tools/regexp
|
||||||
\title Regular Expressions Example
|
\title Regular Expressions Example
|
||||||
|
\ingroup example-widgets-tools
|
||||||
|
|
||||||
\brief The Regular Expressions (RegExp) example shows how regular expressions in Qt are
|
\brief The Regular Expressions (RegExp) example shows how regular expressions in Qt are
|
||||||
applied to text by providing an environment in which new regular expressions can be
|
applied to text by providing an environment in which new regular expressions can be
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/settingseditor
|
\example tools/settingseditor
|
||||||
\title Settings Editor Example
|
\title Settings Editor Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief The Settings Editor example shows how Qt's standard settings support is used in an
|
\brief The Settings Editor example shows how Qt's standard settings support is used in an
|
||||||
application by providing an editor that enables the user to view the settings for
|
application by providing an editor that enables the user to view the settings for
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/styleplugin
|
\example tools/styleplugin
|
||||||
\title Style Plugin Example
|
\title Style Plugin Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief This example shows how to create a plugin that extends Qt with a new
|
\brief This example shows how to create a plugin that extends Qt with a new
|
||||||
GUI look and feel.
|
GUI look and feel.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/treemodelcompleter
|
\example tools/treemodelcompleter
|
||||||
\title Tree Model Completer Example
|
\title Tree Model Completer Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief The Tree Model Completer example shows how to provide completion
|
\brief The Tree Model Completer example shows how to provide completion
|
||||||
facilities for a hierarchical model, using a period as the separator
|
facilities for a hierarchical model, using a period as the separator
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/undo
|
\example tools/undo
|
||||||
\title Undo Framework
|
\title Undo Framework
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief This example shows Qt's undo framework in action.
|
\brief This example shows Qt's undo framework in action.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example tools/undoframework
|
\example tools/undoframework
|
||||||
\title Undo Framework Example
|
\title Undo Framework Example
|
||||||
|
\ingroup examples-widgets-tools
|
||||||
|
|
||||||
\brief This example shows how to implement undo/redo functionality
|
\brief This example shows how to implement undo/redo functionality
|
||||||
with the Qt undo framework.
|
with the Qt undo framework.
|
||||||
|
BIN
src/opengl/doc/images/opengl-examples.png
Normal file
BIN
src/opengl/doc/images/opengl-examples.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
46
src/opengl/doc/src/qtopengl-examples.qdoc
Normal file
46
src/opengl/doc/src/qtopengl-examples.qdoc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:FDL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Free Documentation License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Free
|
||||||
|
** Documentation License version 1.3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file included in the packaging of
|
||||||
|
** this file. Please review the following information to ensure
|
||||||
|
** the GNU Free Documentation License version 1.3 requirements
|
||||||
|
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup all-examples
|
||||||
|
\title OpenGL Examples from the Qt OpenGL module
|
||||||
|
\brief Accessing OpenGL from Qt.
|
||||||
|
\group examples-widgets-opengl
|
||||||
|
|
||||||
|
\image opengl-examples.png
|
||||||
|
|
||||||
|
These examples describe how to use the Qt OpenGL Module. For new code,
|
||||||
|
please use the OpenGL classes in the \l {Qt GUI Module}.
|
||||||
|
|
||||||
|
|
||||||
|
Qt provides support for integration with OpenGL implementations on all
|
||||||
|
platforms, giving developers the opportunity to display hardware accelerated
|
||||||
|
3D graphics alongside a more conventional user interface.
|
||||||
|
|
||||||
|
These examples demonstrate the basic techniques used to take advantage of
|
||||||
|
OpenGL in Qt applications.
|
||||||
|
*/
|
@ -26,10 +26,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\page qtwidgets-examples.html
|
|
||||||
\title Qt Widgets Examples
|
\title Qt Widgets Examples
|
||||||
\brief Lots of examples of how to use different kinds of widgets.
|
\brief Lots of examples of how to use different kinds of widgets.
|
||||||
\ingroup all-examples
|
\ingroup all-examples
|
||||||
|
\group examples-widgets
|
||||||
|
|
||||||
\image widget-examples.png
|
\image widget-examples.png
|
||||||
|
|
||||||
@ -43,12 +43,9 @@
|
|||||||
be used to change the appearance of standard widgets and appropriately
|
be used to change the appearance of standard widgets and appropriately
|
||||||
written custom widgets.
|
written custom widgets.
|
||||||
|
|
||||||
\annotatedlist examples-widgets
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\page examples-painting.html
|
|
||||||
\ingroup all-examples
|
\ingroup all-examples
|
||||||
\title Painting Examples
|
\title Painting Examples
|
||||||
\brief How to use the Qt painting system.
|
\brief How to use the Qt painting system.
|
||||||
@ -56,19 +53,17 @@
|
|||||||
|
|
||||||
\image painting-examples.png
|
\image painting-examples.png
|
||||||
|
|
||||||
Qt's painting system is able to render vector graphics, images, and outline
|
Qt's painting system is able to render vector graphics, images,
|
||||||
font-based text with sub-pixel accuracy accuracy using anti-aliasing to
|
and outline font-based text with sub-pixel accuracy using
|
||||||
improve rendering quality.
|
anti-aliasing to improve rendering quality.
|
||||||
|
|
||||||
These examples show the most common techniques that are used when painting
|
These examples show the most common techniques that are used when painting
|
||||||
with Qt, from basic concepts such as drawing simple primitives to the use of
|
with Qt, from basic concepts such as drawing simple primitives to the use of
|
||||||
transformations.
|
transformations.
|
||||||
|
|
||||||
\annotatedlist{painting-examples}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\page examples-richtext.html
|
|
||||||
\ingroup all-examples
|
\ingroup all-examples
|
||||||
\title Rich Text Examples
|
\title Rich Text Examples
|
||||||
\brief Using the document-oriented rich text engine.
|
\brief Using the document-oriented rich text engine.
|
||||||
@ -84,7 +79,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\page examples-desktop.html
|
|
||||||
\ingroup all-examples
|
\ingroup all-examples
|
||||||
\title Desktop Examples
|
\title Desktop Examples
|
||||||
\brief Integrating your Qt application with your favorite desktop.
|
\brief Integrating your Qt application with your favorite desktop.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user