File: qglwidget.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (262 lines) | stat: -rw-r--r-- 45,186 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGLWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGLWidget Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1><p>The QGLWidget class is a widget for rendering OpenGL graphics. <a href="#details">More...</a></p>
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qglwidget.html#QGLWidget">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, QGLWidget&#160;<i>shareWidget</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qglwidget.html#QGLWidget-2">__init__</a></b> (<i>self</i>, QGLContext, QWidget&#160;<i>parent</i>&#160;=&#160;None, QGLWidget&#160;<i>shareWidget</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qglwidget.html#QGLWidget-3">__init__</a></b> (<i>self</i>, QGLFormat, QWidget&#160;<i>parent</i>&#160;=&#160;None, QGLWidget&#160;<i>shareWidget</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />bool <b><a href="qglwidget.html#autoBufferSwap">autoBufferSwap</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglwidget.html#bindTexture">bindTexture</a></b> (<i>self</i>, QImage, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</li><li><div class="fn" />int <b><a href="qglwidget.html#bindTexture-2">bindTexture</a></b> (<i>self</i>, QPixmap, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</li><li><div class="fn" />int <b><a href="qglwidget.html#bindTexture-3">bindTexture</a></b> (<i>self</i>, QString)</li><li><div class="fn" />int <b><a href="qglwidget.html#bindTexture-4">bindTexture</a></b> (<i>self</i>, QImage, int, int, QGLContext.BindOptions)</li><li><div class="fn" />int <b><a href="qglwidget.html#bindTexture-5">bindTexture</a></b> (<i>self</i>, QPixmap, int, int, QGLContext.BindOptions)</li><li><div class="fn" />QGLColormap <b><a href="qglwidget.html#colormap">colormap</a></b> (<i>self</i>)</li><li><div class="fn" />QGLContext <b><a href="qglwidget.html#context">context</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#deleteTexture">deleteTexture</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qglwidget.html#doneCurrent">doneCurrent</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglwidget.html#doubleBuffer">doubleBuffer</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#drawTexture">drawTexture</a></b> (<i>self</i>, QRectF, int, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</li><li><div class="fn" /><b><a href="qglwidget.html#drawTexture-2">drawTexture</a></b> (<i>self</i>, QPointF, int, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</li><li><div class="fn" />bool <b><a href="qglwidget.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />int <b><a href="qglwidget.html#fontDisplayListBase">fontDisplayListBase</a></b> (<i>self</i>, QFont, int&#160;<i>listBase</i>&#160;=&#160;2000)</li><li><div class="fn" />QGLFormat <b><a href="qglwidget.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#glDraw">glDraw</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#glInit">glInit</a></b> (<i>self</i>)</li><li><div class="fn" />QImage <b><a href="qglwidget.html#grabFrameBuffer">grabFrameBuffer</a></b> (<i>self</i>, bool&#160;<i>withAlpha</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qglwidget.html#initializeGL">initializeGL</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#initializeOverlayGL">initializeOverlayGL</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglwidget.html#isSharing">isSharing</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglwidget.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#makeCurrent">makeCurrent</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#makeOverlayCurrent">makeOverlayCurrent</a></b> (<i>self</i>)</li><li><div class="fn" />QGLContext <b><a href="qglwidget.html#overlayContext">overlayContext</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qglwidget.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qglwidget.html#paintGL">paintGL</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#paintOverlayGL">paintOverlayGL</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#qglClearColor">qglClearColor</a></b> (<i>self</i>, QColor)</li><li><div class="fn" /><b><a href="qglwidget.html#qglColor">qglColor</a></b> (<i>self</i>, QColor)</li><li><div class="fn" />QPixmap <b><a href="qglwidget.html#renderPixmap">renderPixmap</a></b> (<i>self</i>, int&#160;<i>width</i>&#160;=&#160;0, int&#160;<i>height</i>&#160;=&#160;0, bool&#160;<i>useContext</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qglwidget.html#renderText">renderText</a></b> (<i>self</i>, int, int, QString, QFont&#160;<i>font</i>&#160;=&#160;QFont(), int&#160;<i>listBase</i>&#160;=&#160;2000)</li><li><div class="fn" /><b><a href="qglwidget.html#renderText-2">renderText</a></b> (<i>self</i>, float, float, float, QString, QFont&#160;<i>font</i>&#160;=&#160;QFont(), int&#160;<i>listBase</i>&#160;=&#160;2000)</li><li><div class="fn" /><b><a href="qglwidget.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qglwidget.html#resizeGL">resizeGL</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qglwidget.html#resizeOverlayGL">resizeOverlayGL</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qglwidget.html#setAutoBufferSwap">setAutoBufferSwap</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qglwidget.html#setColormap">setColormap</a></b> (<i>self</i>, QGLColormap)</li><li><div class="fn" /><b><a href="qglwidget.html#setContext">setContext</a></b> (<i>self</i>, QGLContext, QGLContext&#160;<i>shareContext</i>&#160;=&#160;None, bool&#160;<i>deleteOldContext</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qglwidget.html#setFormat">setFormat</a></b> (<i>self</i>, QGLFormat)</li><li><div class="fn" /><b><a href="qglwidget.html#setMouseTracking">setMouseTracking</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qglwidget.html#swapBuffers">swapBuffers</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#updateGL">updateGL</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglwidget.html#updateOverlayGL">updateOverlayGL</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QImage <b><a href="qglwidget.html#convertToGLFormat">convertToGLFormat</a></b> (QImage)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGLWidget class is a widget for rendering OpenGL graphics.</p>
<p>QGLWidget provides functionality for displaying OpenGL graphics integrated into a Qt application. It is very simple to use. You inherit from it and use the subclass like any other <a href="qwidget.html">QWidget</a>, except that you have the choice between using <a href="qpainter.html">QPainter</a> and standard OpenGL rendering commands.</p>
<p>QGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks:</p>
<ul>
<li><a href="qglwidget.html#paintGL">paintGL</a>() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated.</li>
<li><a href="qglwidget.html#resizeGL">resizeGL</a>() - Sets up the OpenGL viewport, projection, etc. Gets called whenever the widget has been resized (and also when it is shown for the first time because all newly created widgets get a resize event automatically).</li>
<li><a href="qglwidget.html#initializeGL">initializeGL</a>() - Sets up the OpenGL rendering context, defines display lists, etc. Gets called once before the first time <a href="qglwidget.html#resizeGL">resizeGL</a>() or <a href="qglwidget.html#paintGL">paintGL</a>() is called.</li>
</ul>
<p>Here is a rough outline of how a QGLWidget subclass might look:</p>
<pre> class MyGLDrawer : public QGLWidget
 {
     Q_OBJECT        <span class="comment">// must include this if you use Qt signals/slots</span>

 public:
     MyGLDrawer(QWidget *parent)
         : QGLWidget(parent) {}

 protected:

     void initializeGL()
     {
         <span class="comment">// Set up the rendering context, define display lists etc.:</span>
         ...
         glClearColor(0.0, 0.0, 0.0, 0.0);
         glEnable(GL_DEPTH_TEST);
         ...
     }

     void resizeGL(int w, int h)
     {
         <span class="comment">// setup viewport, projection etc.:</span>
         glViewport(0, 0, (GLint)w, (GLint)h);
         ...
         glFrustum(...);
         ...
     }

     void paintGL()
     {
         <span class="comment">// draw the scene:</span>
         ...
         glRotatef(...);
         glMaterialfv(...);
         glBegin(GL_QUADS);
         glVertex3f(...);
         glVertex3f(...);
         ...
         glEnd();
         ...
     }

 };</pre>
<p>If you need to trigger a repaint from places other than <a href="qglwidget.html#paintGL">paintGL</a>() (a typical example is when using <a href="qtimer.html">timers</a> to animate scenes), you should call the widget's <a href="qglwidget.html#updateGL">updateGL</a>() function.</p>
<p>Your widget's OpenGL rendering context is made current when <a href="qglwidget.html#paintGL">paintGL</a>(), <a href="qglwidget.html#resizeGL">resizeGL</a>(), or <a href="qglwidget.html#initializeGL">initializeGL</a>() is called. If you need to call the standard OpenGL API functions from other places (e.g. in your widget's constructor or in your own paint functions), you must call <a href="qglwidget.html#makeCurrent">makeCurrent</a>() first.</p>
<p>QGLWidget provides functions for requesting a new display <a href="qglformat.html">format</a> and you can also create widgets with customized rendering <a href="qglcontext.html">contexts</a>.</p>
<p>You can also share OpenGL display lists between QGLWidget objects (see the documentation of the QGLWidget constructors for details).</p>
<p>Note that under Windows, the <a href="qglcontext.html">QGLContext</a> belonging to a QGLWidget has to be recreated when the QGLWidget is reparented. This is necessary due to limitations on the Windows platform. This will most likely cause problems for users that have subclassed and installed their own <a href="qglcontext.html">QGLContext</a> on a QGLWidget. It is possible to work around this issue by putting the QGLWidget inside a dummy widget and then reparenting the dummy widget, instead of the QGLWidget. This will side-step the issue altogether, and is what we recommend for users that need this kind of functionality.</p>
<p>On Mac OS X, when Qt is built with Cocoa support, a QGLWidget can't have any sibling widgets placed ontop of itself. This is due to limitations in the Cocoa API and is not supported by Apple.</p>
<a name="overlays" />
<h3>Overlays</h3>
<p>The QGLWidget creates a GL overlay context in addition to the normal context if overlays are supported by the underlying system.</p>
<p>If you want to use overlays, you specify it in the <a href="qglformat.html">format</a>. (Note: Overlay must be requested in the format passed to the QGLWidget constructor.) Your GL widget should also implement some or all of these virtual methods:</p>
<ul>
<li><a href="qglwidget.html#paintOverlayGL">paintOverlayGL</a>()</li>
<li><a href="qglwidget.html#resizeOverlayGL">resizeOverlayGL</a>()</li>
<li><a href="qglwidget.html#initializeOverlayGL">initializeOverlayGL</a>()</li>
</ul>
<p>These methods work in the same way as the normal <a href="qglwidget.html#paintGL">paintGL</a>() etc. functions, except that they will be called when the overlay context is made current. You can explicitly make the overlay context current by using <a href="qglwidget.html#makeOverlayCurrent">makeOverlayCurrent</a>(), and you can access the overlay context directly (e.g. to ask for its transparent color) by calling <a href="qglwidget.html#overlayContext">overlayContext</a>().</p>
<p>On X servers in which the default visual is in an overlay plane, non-GL Qt windows can also be used for overlays.</p>
<a name="painting-techniques" />
<h3>Painting Techniques</h3>
<p>As described above, subclass QGLWidget to render pure 3D content in the following way:</p>
<ul>
<li>Reimplement the <a href="qglwidget.html#initializeGL">QGLWidget.initializeGL</a>() and <a href="qglwidget.html#resizeGL">QGLWidget.resizeGL</a>() to set up the OpenGL state and provide a perspective transformation.</li>
<li>Reimplement <a href="qglwidget.html#paintGL">QGLWidget.paintGL</a>() to paint the 3D scene, calling only OpenGL functions to draw on the widget.</li>
</ul>
<p>It is also possible to draw 2D graphics onto a QGLWidget subclass, it is necessary to reimplement <a href="qglwidget.html#paintEvent">QGLWidget.paintEvent</a>() and do the following:</p>
<ul>
<li>Construct a <a href="qpainter.html">QPainter</a> object.</li>
<li>Initialize it for use on the widget with the <a href="qpainter.html#begin">QPainter.begin</a>() function.</li>
<li>Draw primitives using <a href="qpainter.html">QPainter</a>'s member functions.</li>
<li>Call <a href="qpainter.html#end">QPainter.end</a>() to finish painting.</li>
</ul>
<p>Overpainting 2D content on top of 3D content takes a little more effort. One approach to doing this is shown in the <a href="opengl-overpainting.html">Overpainting</a> example.</p>
<p><i>OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.</i></p>
<p>See also <a href="qglpixelbuffer.html">QGLPixelBuffer</a>, <a href="opengl-hellogl.html">Hello GL Example</a>, <a href="opengl-2dpainting.html">2D Painting Example</a>, <a href="opengl-overpainting.html">Overpainting Example</a>, and <a href="opengl-grabber.html">Grabber Example</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGLWidget" />QGLWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qglwidget.html">QGLWidget</a>&#160;<i>shareWidget</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an OpenGL widget with a <i>parent</i> widget.</p>
<p>The <a href="qglformat.html#defaultFormat">default format</a> is used. The widget will be <a href="qglwidget.html#isValid">invalid</a> if the system has no <a href="qglformat.html#hasOpenGL">OpenGL support</a>.</p>
<p>The <i>parent</i> and widget flag, <i>f</i>, arguments are passed to the <a href="qwidget.html">QWidget</a> constructor.</p>
<p>If <i>shareWidget</i> is a valid <a href="qglwidget.html">QGLWidget</a>, this widget will share OpenGL display lists and texture objects with <i>shareWidget</i>. But if <i>shareWidget</i> and this widget have different <a href="qglwidget.html#format">formats</a>, sharing might not be possible. You can check whether sharing is in effect by calling <a href="qglwidget.html#isSharing">isSharing</a>().</p>
<p>The initialization of OpenGL rendering state, etc. should be done by overriding the <a href="qglwidget.html#initializeGL">initializeGL</a>() function, rather than in the constructor of your <a href="qglwidget.html">QGLWidget</a> subclass.</p>
<p>See also <a href="qglformat.html#defaultFormat">QGLFormat.defaultFormat</a>() and <a href="opengl-textures.html">Textures Example</a>.</p>
<h3 class="fn"><a name="QGLWidget-2" />QGLWidget.__init__ (<i>self</i>, <a href="qglcontext.html">QGLContext</a>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qglwidget.html">QGLWidget</a>&#160;<i>shareWidget</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>QGLContext</i> argument has it's ownership transferred to Qt.</p><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an OpenGL widget with parent <i>parent</i>.</p>
<p>The <i>context</i> argument is a pointer to the <a href="qglcontext.html">QGLContext</a> that you wish to be bound to this widget. This allows you to pass in your own <a href="qglcontext.html">QGLContext</a> sub-classes.</p>
<p>The widget will be <a href="qglwidget.html#isValid">invalid</a> if the system has no <a href="qglformat.html#hasOpenGL">OpenGL support</a>.</p>
<p>The <i>parent</i> and widget flag, <i>f</i>, arguments are passed to the <a href="qwidget.html">QWidget</a> constructor.</p>
<p>If <i>shareWidget</i> is a valid <a href="qglwidget.html">QGLWidget</a>, this widget will share OpenGL display lists and texture objects with <i>shareWidget</i>. But if <i>shareWidget</i> and this widget have different <a href="qglwidget.html#format">formats</a>, sharing might not be possible. You can check whether sharing is in effect by calling <a href="qglwidget.html#isSharing">isSharing</a>().</p>
<p>The initialization of OpenGL rendering state, etc. should be done by overriding the <a href="qglwidget.html#initializeGL">initializeGL</a>() function, rather than in the constructor of your <a href="qglwidget.html">QGLWidget</a> subclass.</p>
<p>See also <a href="qglformat.html#defaultFormat">QGLFormat.defaultFormat</a>() and <a href="qglwidget.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QGLWidget-3" />QGLWidget.__init__ (<i>self</i>, <a href="qglformat.html">QGLFormat</a>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qglwidget.html">QGLWidget</a>&#160;<i>shareWidget</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an OpenGL widget with parent <i>parent</i>.</p>
<p>The <i>format</i> argument specifies the desired <a href="qglformat.html">rendering options</a>. If the underlying OpenGL/Window system cannot satisfy all the features requested in <i>format</i>, the nearest subset of features will be used. After creation, the <a href="qglwidget.html#format">format</a>() method will return the actual format obtained.</p>
<p>The widget will be <a href="qglwidget.html#isValid">invalid</a> if the system has no <a href="qglformat.html#hasOpenGL">OpenGL support</a>.</p>
<p>The <i>parent</i> and widget flag, <i>f</i>, arguments are passed to the <a href="qwidget.html">QWidget</a> constructor.</p>
<p>If <i>shareWidget</i> is a valid <a href="qglwidget.html">QGLWidget</a>, this widget will share OpenGL display lists and texture objects with <i>shareWidget</i>. But if <i>shareWidget</i> and this widget have different <a href="qglwidget.html#format">formats</a>, sharing might not be possible. You can check whether sharing is in effect by calling <a href="qglwidget.html#isSharing">isSharing</a>().</p>
<p>The initialization of OpenGL rendering state, etc. should be done by overriding the <a href="qglwidget.html#initializeGL">initializeGL</a>() function, rather than in the constructor of your <a href="qglwidget.html">QGLWidget</a> subclass.</p>
<p>See also <a href="qglformat.html#defaultFormat">QGLFormat.defaultFormat</a>() and <a href="qglwidget.html#isValid">isValid</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/~QGLWidget" />
<h3 class="fn"><a name="autoBufferSwap" />bool QGLWidget.autoBufferSwap (<i>self</i>)</h3><p>Returns true if the widget is doing automatic GL buffer swapping; otherwise returns false.</p>
<p>See also <a href="qglwidget.html#setAutoBufferSwap">setAutoBufferSwap</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/bindTexture" />
<h3 class="fn"><a name="bindTexture" />int QGLWidget.bindTexture (<i>self</i>, <a href="qimage.html">QImage</a>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</h3><p>Calls QGLContext.:bindTexture(<i>image</i>, <i>target</i>, <i>format</i>) on the currently set context.</p>
<p>See also <a href="qglwidget.html#deleteTexture">deleteTexture</a>().</p>
<h3 class="fn"><a name="bindTexture-2" />int QGLWidget.bindTexture (<i>self</i>, <a href="qpixmap.html">QPixmap</a>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</h3><p>Calls QGLContext.:bindTexture(<i>pixmap</i>, <i>target</i>, <i>format</i>) on the currently set context.</p>
<p>See also <a href="qglwidget.html#deleteTexture">deleteTexture</a>().</p>
<h3 class="fn"><a name="bindTexture-3" />int QGLWidget.bindTexture (<i>self</i>, QString)</h3><p>This is an overloaded function.</p>
<p>The binding <i>options</i> are a set of options used to decide how to bind the texture to the context.</p>
<p>This function was introduced in Qt 4.6.</p>
<h3 class="fn"><a name="bindTexture-4" />int QGLWidget.bindTexture (<i>self</i>, <a href="qimage.html">QImage</a>, int, int, <a href="qglcontext-bindoptions.html">QGLContext.BindOptions</a>)</h3><p>This is an overloaded function.</p>
<p>Generates and binds a 2D GL texture to the current context, based on <i>pixmap</i>. The generated texture id is returned and can be used in</p>
<p>The binding <i>options</i> are a set of options used to decide how to bind the texture to the context.</p>
<p>This function was introduced in Qt 4.6.</p>
<h3 class="fn"><a name="bindTexture-5" />int QGLWidget.bindTexture (<i>self</i>, <a href="qpixmap.html">QPixmap</a>, int, int, <a href="qglcontext-bindoptions.html">QGLContext.BindOptions</a>)</h3><p>This is an overloaded function.</p>
<p>Calls QGLContext.bindTexture(<i>fileName</i>) on the currently set context.</p>
<p>See also <a href="qglwidget.html#deleteTexture">deleteTexture</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/colormap" />
<h3 class="fn"><a name="colormap" /><a href="qglcolormap.html">QGLColormap</a> QGLWidget.colormap (<i>self</i>)</h3><p>Returns the colormap for this widget.</p>
<p>Usually it is only top-level widgets that can have different colormaps installed. Asking for the colormap of a child widget will return the colormap for the child's top-level widget.</p>
<p>If no colormap has been set for this widget, the <a href="qglcolormap.html">QGLColormap</a> returned will be empty.</p>
<p>See also <a href="qglwidget.html#setColormap">setColormap</a>() and <a href="qglcolormap.html#isEmpty">QGLColormap.isEmpty</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/context" />
<h3 class="fn"><a name="context" /><a href="qglcontext.html">QGLContext</a> QGLWidget.context (<i>self</i>)</h3><p>Returns the context of this widget.</p>
<p>It is possible that the context is not valid (see <a href="qglwidget.html#isValid">isValid</a>()), for example, if the underlying hardware does not support the format attributes that were requested.</p>
<a name="//apple_ref/cpp/clm/QGLWidget/convertToGLFormat" />
<h3 class="fn"><a name="convertToGLFormat" /><a href="qimage.html">QImage</a> QGLWidget.convertToGLFormat (<a href="qimage.html">QImage</a>)</h3><p>Converts the image <i>img</i> into the unnamed format expected by OpenGL functions such as glTexImage2D(). The returned image is not usable as a <a href="qimage.html">QImage</a>, but <a href="qimage.html#width">QImage.width</a>(), <a href="qimage.html#height">QImage.height</a>() and <a href="qimage.html#bits">QImage.bits</a>() may be used with OpenGL. The GL format used is <tt>GL_RGBA</tt>.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/deleteTexture" />
<h3 class="fn"><a name="deleteTexture" />QGLWidget.deleteTexture (<i>self</i>, int)</h3><p>Calls QGLContext.deleteTexture(<i>id</i>) on the currently set context.</p>
<p>See also <a href="qglwidget.html#bindTexture">bindTexture</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/doneCurrent" />
<h3 class="fn"><a name="doneCurrent" />QGLWidget.doneCurrent (<i>self</i>)</h3><p>Makes no GL context the current context. Normally, you do not need to call this function; <a href="qglcontext.html">QGLContext</a> calls it as necessary. However, it may be useful in multithreaded environments.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/doubleBuffer" />
<h3 class="fn"><a name="doubleBuffer" />bool QGLWidget.doubleBuffer (<i>self</i>)</h3><p>Returns true if the contained GL rendering context has double buffering; otherwise returns false.</p>
<p>See also <a href="qglformat.html#doubleBuffer">QGLFormat.doubleBuffer</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/drawTexture" />
<h3 class="fn"><a name="drawTexture" />QGLWidget.drawTexture (<i>self</i>, <a href="qrectf.html">QRectF</a>, int, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</h3><p>Draws the given texture, <i>textureId</i> to the given target rectangle, <i>target</i>, in OpenGL model space. The <i>textureTarget</i> should be a 2D texture target.</p>
<p>Equivalent to the corresponding <a href="qglcontext.html#drawTexture">QGLContext.drawTexture</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="drawTexture-2" />QGLWidget.drawTexture (<i>self</i>, <a href="qpointf.html">QPointF</a>, int, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</h3><p>Draws the given texture, <i>textureId</i>, at the given <i>point</i> in OpenGL model space. The <i>textureTarget</i> should be a 2D texture target.</p>
<p>Equivalent to the corresponding <a href="qglcontext.html#drawTexture">QGLContext.drawTexture</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/event" />
<h3 class="fn"><a name="event" />bool QGLWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/format" />
<h3 class="fn"><a name="fontDisplayListBase" />int QGLWidget.fontDisplayListBase (<i>self</i>, <a href="qfont.html">QFont</a>, int&#160;<i>listBase</i>&#160;=&#160;2000)</h3><h3 class="fn"><a name="format" /><a href="qglformat.html">QGLFormat</a> QGLWidget.format (<i>self</i>)</h3><p>Returns the format of the contained GL rendering context.</p>
<p>See also <a class="obsolete" href="qglwidget-obsolete.html#setFormat">setFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/glDraw" />
<h3 class="fn"><a name="glDraw" />QGLWidget.glDraw (<i>self</i>)</h3><p>Executes the virtual function <a href="qglwidget.html#paintGL">paintGL</a>().</p>
<p>The widget's rendering context will become the current context and <a href="qglwidget.html#initializeGL">initializeGL</a>() will be called if it hasn't already been called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/glInit" />
<h3 class="fn"><a name="glInit" />QGLWidget.glInit (<i>self</i>)</h3><p>Initializes OpenGL for this widget's context. Calls the virtual function <a href="qglwidget.html#initializeGL">initializeGL</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/grabFrameBuffer" />
<h3 class="fn"><a name="grabFrameBuffer" /><a href="qimage.html">QImage</a> QGLWidget.grabFrameBuffer (<i>self</i>, bool&#160;<i>withAlpha</i>&#160;=&#160;False)</h3><p>Returns an image of the frame buffer. If <i>withAlpha</i> is true the alpha channel is included.</p>
<p>Depending on your hardware, you can explicitly select which color buffer to grab with a glReadBuffer() call before calling this function.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/initializeGL" />
<h3 class="fn"><a name="initializeGL" />QGLWidget.initializeGL (<i>self</i>)</h3><p>This virtual function is called once before the first call to <a href="qglwidget.html#paintGL">paintGL</a>() or <a href="qglwidget.html#resizeGL">resizeGL</a>(), and then once whenever the widget has been assigned a new <a href="qglcontext.html">QGLContext</a>. Reimplement it in a subclass.</p>
<p>This function should set up any required OpenGL context rendering flags, defining display lists, etc.</p>
<p>There is no need to call <a href="qglwidget.html#makeCurrent">makeCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/initializeOverlayGL" />
<h3 class="fn"><a name="initializeOverlayGL" />QGLWidget.initializeOverlayGL (<i>self</i>)</h3><p>This virtual function is used in the same manner as <a href="qglwidget.html#initializeGL">initializeGL</a>() except that it operates on the widget's overlay context instead of the widget's main context. This means that initializeOverlayGL() is called once before the first call to <a href="qglwidget.html#paintOverlayGL">paintOverlayGL</a>() or <a href="qglwidget.html#resizeOverlayGL">resizeOverlayGL</a>(). Reimplement it in a subclass.</p>
<p>This function should set up any required OpenGL context rendering flags, defining display lists, etc. for the overlay context.</p>
<p>There is no need to call <a href="qglwidget.html#makeOverlayCurrent">makeOverlayCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/isSharing" />
<h3 class="fn"><a name="isSharing" />bool QGLWidget.isSharing (<i>self</i>)</h3><p>Returns true if this widget's GL context is shared with another GL context, otherwise false is returned. Context sharing might not be possible if the widgets use different formats.</p>
<p>See also <a href="qglwidget.html#format">format</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/isValid" />
<h3 class="fn"><a name="isValid" />bool QGLWidget.isValid (<i>self</i>)</h3><p>Returns true if the widget has a valid GL rendering context; otherwise returns false. A widget will be invalid if the system has no <a href="qglformat.html#hasOpenGL">OpenGL support</a>.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/makeCurrent" />
<h3 class="fn"><a name="makeCurrent" />QGLWidget.makeCurrent (<i>self</i>)</h3><p>Makes this widget the current widget for OpenGL operations, i.e. makes the widget's rendering context the current OpenGL rendering context.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/makeOverlayCurrent" />
<h3 class="fn"><a name="makeOverlayCurrent" />QGLWidget.makeOverlayCurrent (<i>self</i>)</h3><p>Makes the overlay context of this widget current. Use this if you need to issue OpenGL commands to the overlay context outside of <a href="qglwidget.html#initializeOverlayGL">initializeOverlayGL</a>(), <a href="qglwidget.html#resizeOverlayGL">resizeOverlayGL</a>(), and <a href="qglwidget.html#paintOverlayGL">paintOverlayGL</a>().</p>
<p>Does nothing if this widget has no overlay.</p>
<p>See also <a href="qglwidget.html#makeCurrent">makeCurrent</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/overlayContext" />
<h3 class="fn"><a name="overlayContext" /><a href="qglcontext.html">QGLContext</a> QGLWidget.overlayContext (<i>self</i>)</h3><p>Returns the overlay context of this widget, or 0 if this widget has no overlay.</p>
<p>See also <a href="qglwidget.html#context">context</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/paintEvent" />
<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QGLWidget.paintEngine (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QGLWidget.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>Handles paint events passed in the <i>event</i> parameter. Will cause the virtual <a href="qglwidget.html#paintGL">paintGL</a>() function to be called.</p>
<p>The widget's rendering context will become the current context and <a href="qglwidget.html#initializeGL">initializeGL</a>() will be called if it hasn't already been called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/paintGL" />
<h3 class="fn"><a name="paintGL" />QGLWidget.paintGL (<i>self</i>)</h3><p>This virtual function is called whenever the widget needs to be painted. Reimplement it in a subclass.</p>
<p>There is no need to call <a href="qglwidget.html#makeCurrent">makeCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/paintOverlayGL" />
<h3 class="fn"><a name="paintOverlayGL" />QGLWidget.paintOverlayGL (<i>self</i>)</h3><p>This virtual function is used in the same manner as <a href="qglwidget.html#paintGL">paintGL</a>() except that it operates on the widget's overlay context instead of the widget's main context. This means that paintOverlayGL() is called whenever the widget's overlay needs to be painted. Reimplement it in a subclass.</p>
<p>There is no need to call <a href="qglwidget.html#makeOverlayCurrent">makeOverlayCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/qglClearColor" />
<h3 class="fn"><a name="qglClearColor" />QGLWidget.qglClearColor (<i>self</i>, <a href="qcolor.html">QColor</a>)</h3><p>Convenience function for specifying the clearing color to OpenGL. Calls glClearColor (in RGBA mode) or glClearIndex (in color-index mode) with the color <i>c</i>. Applies to this widgets GL context.</p>
<p>See also <a href="qglwidget.html#qglColor">qglColor</a>(), <a href="qglcontext.html#currentContext">QGLContext.currentContext</a>(), and <a href="qcolor.html">QColor</a>.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/qglColor" />
<h3 class="fn"><a name="qglColor" />QGLWidget.qglColor (<i>self</i>, <a href="qcolor.html">QColor</a>)</h3><p>Convenience function for specifying a drawing color to OpenGL. Calls glColor4 (in RGBA mode) or glIndex (in color-index mode) with the color <i>c</i>. Applies to this widgets GL context.</p>
<p><b>Note:</b> This function is not supported on OpenGL/ES 2.0 systems.</p>
<p>See also <a href="qglwidget.html#qglClearColor">qglClearColor</a>(), <a href="qglcontext.html#currentContext">QGLContext.currentContext</a>(), and <a href="qcolor.html">QColor</a>.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/renderPixmap" />
<h3 class="fn"><a name="renderPixmap" /><a href="qpixmap.html">QPixmap</a> QGLWidget.renderPixmap (<i>self</i>, int&#160;<i>width</i>&#160;=&#160;0, int&#160;<i>height</i>&#160;=&#160;0, bool&#160;<i>useContext</i>&#160;=&#160;False)</h3><p>Renders the current scene on a pixmap and returns the pixmap.</p>
<p>You can use this method on both visible and invisible <a href="qglwidget.html">QGLWidget</a> objects.</p>
<p>This method will create a pixmap and a temporary <a href="qglcontext.html">QGLContext</a> to render on the pixmap. It will then call <a href="qglwidget.html#initializeGL">initializeGL</a>(), <a href="qglwidget.html#resizeGL">resizeGL</a>(), and <a href="qglwidget.html#paintGL">paintGL</a>() on this context. Finally, the widget's original GL context is restored.</p>
<p>The size of the pixmap will be <i>w</i> pixels wide and <i>h</i> pixels high unless one of these parameters is 0 (the default), in which case the pixmap will have the same size as the widget.</p>
<p>If <i>useContext</i> is true, this method will try to be more efficient by using the existing GL context to render the pixmap. The default is false. Only use true if you understand the risks. Note that under Windows a temporary context has to be created and usage of the <i>useContext</i> parameter is not supported.</p>
<p>Overlays are not rendered onto the pixmap.</p>
<p>If the GL rendering context and the desktop have different bit depths, the result will most likely look surprising.</p>
<p>Note that the creation of display lists, modifications of the view frustum etc. should be done from within <a href="qglwidget.html#initializeGL">initializeGL</a>(). If this is not done, the temporary <a href="qglcontext.html">QGLContext</a> will not be initialized properly, and the rendered pixmap may be incomplete/corrupted.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/renderText" />
<h3 class="fn"><a name="renderText" />QGLWidget.renderText (<i>self</i>, int, int, QString, <a href="qfont.html">QFont</a>&#160;<i>font</i>&#160;=&#160;QFont(), int&#160;<i>listBase</i>&#160;=&#160;2000)</h3><p>Renders the string <i>str</i> into the GL context of this widget.</p>
<p><i>x</i> and <i>y</i> are specified in window coordinates, with the origin in the upper left-hand corner of the window. If <i>font</i> is not specified, the currently set application font will be used to render the string. To change the color of the rendered text you can use the glColor() call (or the <a href="qglwidget.html#qglColor">qglColor</a>() convenience function), just before the renderText() call.</p>
<p>The <i>listBase</i> parameter is obsolete and will be removed in a future version of Qt.</p>
<p><b>Note:</b> This function clears the stencil buffer.</p>
<p><b>Note:</b> This function is not supported on OpenGL/ES systems.</p>
<p><b>Note:</b> This function temporarily disables depth-testing when the text is drawn.</p>
<p><b>Note:</b> This function can only be used inside a <a href="qpainter.html#beginNativePainting">QPainter.beginNativePainting</a>()/<a href="qpainter.html#endNativePainting">QPainter.endNativePainting</a>() block if the default OpenGL paint engine is <a href="qpaintengine.html#Type-enum">QPaintEngine.OpenGL</a>. To make <a href="qpaintengine.html#Type-enum">QPaintEngine.OpenGL</a> the default GL engine, call QGL.setPreferredPaintEngine(<a href="qpaintengine.html#Type-enum">QPaintEngine.OpenGL</a>) before the <a href="qapplication.html">QApplication</a> constructor.</p>
<p><a href="opengl-overpainting.html">Overpaint</a> with <a href="qpainter.html#drawText">QPainter.drawText</a>() instead.</p>
<h3 class="fn"><a name="renderText-2" />QGLWidget.renderText (<i>self</i>, float, float, float, QString, <a href="qfont.html">QFont</a>&#160;<i>font</i>&#160;=&#160;QFont(), int&#160;<i>listBase</i>&#160;=&#160;2000)</h3><p>This is an overloaded function.</p>
<p><i>x</i>, <i>y</i> and <i>z</i> are specified in scene or object coordinates relative to the currently set projection and model matrices. This can be useful if you want to annotate models with text labels and have the labels move with the model as it is rotated etc.</p>
<p><b>Note:</b> This function is not supported on OpenGL/ES systems.</p>
<p><b>Note:</b> If depth testing is enabled before this function is called, then the drawn text will be depth-tested against the models that have already been drawn in the scene. Use <tt>glDisable(GL_DEPTH_TEST)</tt> before calling this function to annotate the models without depth-testing the text.</p>
<p><a href="opengl-overpainting.html">Overpaint</a> with <a href="qpainter.html#drawText">QPainter.drawText</a>() instead.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/resizeEvent" />
<h3 class="fn"><a name="resizeEvent" />QGLWidget.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<p>Handles resize events that are passed in the <i>event</i> parameter. Calls the virtual function <a href="qglwidget.html#resizeGL">resizeGL</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/resizeGL" />
<h3 class="fn"><a name="resizeGL" />QGLWidget.resizeGL (<i>self</i>, int, int)</h3><p>This virtual function is called whenever the widget has been resized. The new size is passed in <i>width</i> and <i>height</i>. Reimplement it in a subclass.</p>
<p>There is no need to call <a href="qglwidget.html#makeCurrent">makeCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/resizeOverlayGL" />
<h3 class="fn"><a name="resizeOverlayGL" />QGLWidget.resizeOverlayGL (<i>self</i>, int, int)</h3><p>This virtual function is used in the same manner as <a href="qglwidget.html#paintGL">paintGL</a>() except that it operates on the widget's overlay context instead of the widget's main context. This means that resizeOverlayGL() is called whenever the widget has been resized. The new size is passed in <i>width</i> and <i>height</i>. Reimplement it in a subclass.</p>
<p>There is no need to call <a href="qglwidget.html#makeOverlayCurrent">makeOverlayCurrent</a>() because this has already been done when this function is called.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/setAutoBufferSwap" />
<h3 class="fn"><a name="setAutoBufferSwap" />QGLWidget.setAutoBufferSwap (<i>self</i>, bool)</h3><p>If <i>on</i> is true automatic GL buffer swapping is switched on; otherwise it is switched off.</p>
<p>If <i>on</i> is true and the widget is using a double-buffered format, the background and foreground GL buffers will automatically be swapped after each <a href="qglwidget.html#paintGL">paintGL</a>() call.</p>
<p>The buffer auto-swapping is on by default.</p>
<p>See also <a href="qglwidget.html#autoBufferSwap">autoBufferSwap</a>(), <a href="qglwidget.html#doubleBuffer">doubleBuffer</a>(), and <a href="qglwidget.html#swapBuffers">swapBuffers</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/setColormap" />
<h3 class="fn"><a name="setColormap" />QGLWidget.setColormap (<i>self</i>, <a href="qglcolormap.html">QGLColormap</a>)</h3><p>Set the colormap for this widget to <i>cmap</i>. Usually it is only top-level widgets that can have colormaps installed.</p>
<p>See also <a href="qglwidget.html#colormap">colormap</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/setMouseTracking" />
<h3 class="fn"><a name="setContext" />QGLWidget.setContext (<i>self</i>, <a href="qglcontext.html">QGLContext</a>, <a href="qglcontext.html">QGLContext</a>&#160;<i>shareContext</i>&#160;=&#160;None, bool&#160;<i>deleteOldContext</i>&#160;=&#160;True)</h3><h3 class="fn"><a name="setFormat" />QGLWidget.setFormat (<i>self</i>, <a href="qglformat.html">QGLFormat</a>)</h3><h3 class="fn"><a name="setMouseTracking" />QGLWidget.setMouseTracking (<i>self</i>, bool)</h3><p>If <i>enable</i> is true then mouse tracking is enabled; otherwise it is disabled.</p>
<a name="//apple_ref/cpp/instm/QGLWidget/swapBuffers" />
<h3 class="fn"><a name="swapBuffers" />QGLWidget.swapBuffers (<i>self</i>)</h3><p>Swaps the screen contents with an off-screen buffer. This only works if the widget's format specifies double buffer mode.</p>
<p>Normally, there is no need to explicitly call this function because it is done automatically after each widget repaint, i.e. each time after <a href="qglwidget.html#paintGL">paintGL</a>() has been executed.</p>
<p>See also <a href="qglwidget.html#doubleBuffer">doubleBuffer</a>(), <a href="qglwidget.html#setAutoBufferSwap">setAutoBufferSwap</a>(), and <a href="qglformat.html#setDoubleBuffer">QGLFormat.setDoubleBuffer</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/updateGL" />
<h3 class="fn"><a name="updateGL" />QGLWidget.updateGL (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void updateGL()</tt>.</p><p>Updates the widget by calling <a href="qglwidget.html#glDraw">glDraw</a>().</p>
<a name="//apple_ref/cpp/instm/QGLWidget/updateOverlayGL" />
<h3 class="fn"><a name="updateOverlayGL" />QGLWidget.updateOverlayGL (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void updateOverlayGL()</tt>.</p><p>Updates the widget's overlay (if any). Will cause the virtual function <a href="qglwidget.html#paintOverlayGL">paintOverlayGL</a>() to be executed.</p>
<p>The widget's rendering context will become the current context and <a href="qglwidget.html#initializeGL">initializeGL</a>() will be called if it hasn't already been called.</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>