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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
|
'\" t
.TH QGLWidget 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QGLWidget \- Widget for rendering OpenGL graphics
.SH SYNOPSIS
\fC#include <ntqgl.h>\fR
.PP
Inherits QWidget and QGL.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQGLWidget\fR ( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "\fBQGLWidget\fR ( QGLContext * context, QWidget * parent, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "\fBQGLWidget\fR ( const QGLFormat & format, QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "\fB~QGLWidget\fR ()"
.br
.ti -1c
.BI "void \fBqglColor\fR ( const QColor & c ) const"
.br
.ti -1c
.BI "void \fBqglClearColor\fR ( const QColor & c ) const"
.br
.ti -1c
.BI "bool \fBisValid\fR () const"
.br
.ti -1c
.BI "bool \fBisSharing\fR () const"
.br
.ti -1c
.BI "virtual void \fBmakeCurrent\fR ()"
.br
.ti -1c
.BI "void \fBdoneCurrent\fR ()"
.br
.ti -1c
.BI "bool \fBdoubleBuffer\fR () const"
.br
.ti -1c
.BI "virtual void \fBswapBuffers\fR ()"
.br
.ti -1c
.BI "QGLFormat \fBformat\fR () const"
.br
.ti -1c
.BI "const QGLContext * \fBcontext\fR () const"
.br
.ti -1c
.BI "virtual QPixmap \fBrenderPixmap\fR ( int w = 0, int h = 0, bool useContext = FALSE )"
.br
.ti -1c
.BI "virtual QImage \fBgrabFrameBuffer\fR ( bool withAlpha = FALSE )"
.br
.ti -1c
.BI "virtual void \fBmakeOverlayCurrent\fR ()"
.br
.ti -1c
.BI "const QGLContext * \fBoverlayContext\fR () const"
.br
.ti -1c
.BI "const QGLColormap & \fBcolormap\fR () const"
.br
.ti -1c
.BI "void \fBsetColormap\fR ( const QGLColormap & cmap )"
.br
.ti -1c
.BI "void \fBrenderText\fR ( int x, int y, const QString & str, const QFont & fnt = QFont ( ), int listBase = 2000 )"
.br
.ti -1c
.BI "void \fBrenderText\fR ( double x, double y, double z, const QString & str, const QFont & fnt = QFont ( ), int listBase = 2000 )"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBupdateGL\fR ()"
.br
.ti -1c
.BI "virtual void \fBupdateOverlayGL\fR ()"
.br
.in -1c
.SS "Static Public Members"
.in +1c
.ti -1c
.BI "QImage \fBconvertToGLFormat\fR ( const QImage & img )"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual void \fBinitializeGL\fR ()"
.br
.ti -1c
.BI "virtual void \fBresizeGL\fR ( int width, int height )"
.br
.ti -1c
.BI "virtual void \fBpaintGL\fR ()"
.br
.ti -1c
.BI "virtual void \fBinitializeOverlayGL\fR ()"
.br
.ti -1c
.BI "virtual void \fBresizeOverlayGL\fR ( int width, int height )"
.br
.ti -1c
.BI "virtual void \fBpaintOverlayGL\fR ()"
.br
.ti -1c
.BI "void \fBsetAutoBufferSwap\fR ( bool on )"
.br
.ti -1c
.BI "bool \fBautoBufferSwap\fR () const"
.br
.ti -1c
.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * )"
.br
.ti -1c
.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * )"
.br
.ti -1c
.BI "virtual void \fBglInit\fR ()"
.br
.ti -1c
.BI "virtual void \fBglDraw\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QGLWidget class is a widget for rendering OpenGL graphics.
.PP
QGLWidget provides functionality for displaying OpenGL<sup>*</sup> graphics integrated into a Qt application. It is very simple to use. You inherit from it and use the subclass like any other QWidget, except that instead of drawing the widget's contents using QPainter etc. you use the standard OpenGL rendering commands.
.PP
QGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks:
.TP
paintGL() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated.
.TP
resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets called whenever the 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).
.TP
initializeGL() - Sets up the OpenGL rendering context, defines display lists, etc. Gets called once before the first time resizeGL() or paintGL() is called.
.PP
Here is a rough outline of how a QGLWidget subclass might look:
.PP
.nf
.br
class MyGLDrawer : public QGLWidget
.br
{
.br
Q_OBJECT // must include this if you use Qt signals/slots
.br
.br
public:
.br
MyGLDrawer( QWidget *parent, const char *name )
.br
: QGLWidget(parent, name) {}
.br
.br
protected:
.br
.br
void initializeGL()
.br
{
.br
// Set up the rendering context, define display lists etc.:
.br
...
.br
glClearColor( 0.0, 0.0, 0.0, 0.0 );
.br
glEnable(GL_DEPTH_TEST);
.br
...
.br
}
.br
.br
void resizeGL( int w, int h )
.br
{
.br
// setup viewport, projection etc.:
.br
glViewport( 0, 0, (GLint)w, (GLint)h );
.br
...
.br
glFrustum( ... );
.br
...
.br
}
.br
.br
void paintGL()
.br
{
.br
// draw the scene:
.br
...
.br
glRotatef( ... );
.br
glMaterialfv( ... );
.br
glBegin( GL_QUADS );
.br
glVertex3f( ... );
.br
glVertex3f( ... );
.br
...
.br
glEnd();
.br
...
.br
}
.br
.br
};
.br
.fi
.PP
If you need to trigger a repaint from places other than paintGL() (a typical example is when using timers to animate scenes), you should call the widget's updateGL() function.
.PP
Your widget's OpenGL rendering context is made current when paintGL(), resizeGL(), or initializeGL() 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 makeCurrent() first.
.PP
QGLWidget provides functions for requesting a new display format and you can also create widgets with customized rendering contexts.
.PP
You can also share OpenGL display lists between QGLWidgets (see the documentation of the QGLWidget constructors for details).
.SH "Overlays"
The QGLWidget creates a GL overlay context in addition to the normal context if overlays are supported by the underlying system.
.PP
If you want to use overlays, you specify it in the format. (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:
.TP
paintOverlayGL()
.TP
resizeOverlayGL()
.TP
initializeOverlayGL()
.PP
These methods work in the same way as the normal paintGL() 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 makeOverlayCurrent(), and you can access the overlay context directly (e.g. to ask for its transparent color) by calling overlayContext().
.PP
On X servers in which the default visual is in an overlay plane, non-GL Qt windows can also be used for overlays. See the examples/opengl/overlay_x11 example program for details.
.PP
<sup>*</sup> OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.
.PP
See also Graphics Classes and Image Processing Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QGLWidget::QGLWidget ( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
Constructs an OpenGL widget with a \fIparent\fR widget and a \fIname\fR.
.PP
The default format is used. The widget will be invalid if the system has no OpenGL support.
.PP
The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the QWidget constructor.
.PP
If the \fIshareWidget\fR parameter points to a valid QGLWidget, this widget will share OpenGL display lists with \fIshareWidget\fR. If this widget and \fIshareWidget\fR have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().
.PP
The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.
.PP
See also QGLFormat::defaultFormat().
.SH "QGLWidget::QGLWidget ( QGLContext * context, QWidget * parent, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
Constructs an OpenGL widget with parent \fIparent\fR, called \fIname\fR.
.PP
The \fIcontext\fR argument is a pointer to the QGLContext that you wish to be bound to this widget. This allows you to pass in your own QGLContext sub-classes.
.PP
The widget will be invalid if the system has no OpenGL support.
.PP
The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the QWidget constructor.
.PP
If the \fIshareWidget\fR parameter points to a valid QGLWidget, this widget will share OpenGL display lists with \fIshareWidget\fR. If this widget and \fIshareWidget\fR have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().
.PP
The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.
.PP
See also QGLFormat::defaultFormat() and isValid().
.SH "QGLWidget::QGLWidget ( const QGLFormat & format, QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )"
Constructs an OpenGL widget with parent \fIparent\fR, called \fIname\fR.
.PP
The \fIformat\fR argument specifies the desired rendering options. If the underlying OpenGL/Window system cannot satisfy all the features requested in \fIformat\fR, the nearest subset of features will be used. After creation, the format() method will return the actual format obtained.
.PP
The widget will be invalid if the system has no OpenGL support.
.PP
The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the QWidget constructor.
.PP
If the \fIshareWidget\fR parameter points to a valid QGLWidget, this widget will share OpenGL display lists with \fIshareWidget\fR. If this widget and \fIshareWidget\fR have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().
.PP
The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.
.PP
See also QGLFormat::defaultFormat() and isValid().
.SH "QGLWidget::~QGLWidget ()"
Destroys the widget.
.SH "bool QGLWidget::autoBufferSwap () const\fC [protected]\fR"
Returns TRUE if the widget is doing automatic GL buffer swapping; otherwise returns FALSE.
.PP
See also setAutoBufferSwap().
.SH "const QGLColormap & QGLWidget::colormap () const"
Returns the colormap for this widget.
.PP
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.
.PP
If no colormap has been set for this widget, the QColormap returned will be empty.
.PP
See also setColormap().
.SH "const QGLContext * QGLWidget::context () const"
Returns the context of this widget.
.PP
It is possible that the context is not valid (see isValid()), for example, if the underlying hardware does not support the format attributes that were requested.
.SH "QImage QGLWidget::convertToGLFormat ( const QImage & img )\fC [static]\fR"
Converts the image \fIimg\fR into the unnamed format expected by OpenGL functions such as glTexImage2D(). The returned image is not usable as a QImage, but QImage::width(), QImage::height() and QImage::bits() may be used with OpenGL. The following few lines are from the texture example. Most of the code is irrelevant, so we just quote the relevant bits:
.PP
.nf
.br
QImage tex1, tex2, buf;
.br
if ( !buf.load( "gllogo.bmp" ) ) { // Load first image from file
.fi
.PP
We create \fItex1\fR (and another variable) for OpenGL, and load a real image into \fIbuf\fR.
.PP
.nf
.br
tex1 = QGLWidget::convertToGLFormat( buf ); // flipped 32bit RGBA
.fi
.PP
A few lines later, we convert \fIbuf\fR into OpenGL format and store it in \fItex1\fR.
.PP
.nf
.br
glTexImage2D( GL_TEXTURE_2D, 0, 3, tex1.width(), tex1.height(), 0,
.br
GL_RGBA, GL_UNSIGNED_BYTE, tex1.bits() );
.fi
.PP
Note the dimension restrictions for texture images as described in the glTexImage2D() documentation. The width must be 2^m + 2*border and the height 2^n + 2*border where m and n are integers and border is either 0 or 1.
.PP
Another function in the same example uses \fItex1\fR with OpenGL.
.PP
Example: opengl/texture/gltexobj.cpp.
.SH "void QGLWidget::doneCurrent ()"
Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary. However, it may be useful in multithreaded environments.
.SH "bool QGLWidget::doubleBuffer () const"
Returns TRUE if the contained GL rendering context has double buffering; otherwise returns FALSE.
.PP
See also QGLFormat::doubleBuffer().
.SH "QGLFormat QGLWidget::format () const"
Returns the format of the contained GL rendering context.
.SH "void QGLWidget::glDraw ()\fC [virtual protected]\fR"
Executes the virtual function paintGL().
.PP
The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.
.SH "void QGLWidget::glInit ()\fC [virtual protected]\fR"
Initializes OpenGL for this widget's context. Calls the virtual function initializeGL().
.SH "QImage QGLWidget::grabFrameBuffer ( bool withAlpha = FALSE )\fC [virtual]\fR"
Returns an image of the frame buffer. If \fIwithAlpha\fR is TRUE the alpha channel is included.
.PP
Depending on your hardware, you can explicitly select which color buffer to grab with a glReadBuffer() call before calling this function.
.SH "void QGLWidget::initializeGL ()\fC [virtual protected]\fR"
This virtual function is called once before the first call to paintGL() or resizeGL(), and then once whenever the widget has been assigned a new QGLContext. Reimplement it in a subclass.
.PP
This function should set up any required OpenGL context rendering flags, defining display lists, etc.
.PP
There is no need to call makeCurrent() because this has already been done when this function is called.
.SH "void QGLWidget::initializeOverlayGL ()\fC [virtual protected]\fR"
This virtual function is used in the same manner as initializeGL() 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 paintOverlayGL() or resizeOverlayGL(). Reimplement it in a subclass.
.PP
This function should set up any required OpenGL context rendering flags, defining display lists, etc. for the overlay context.
.PP
There is no need to call makeOverlayCurrent() because this has already been done when this function is called.
.SH "bool QGLWidget::isSharing () const"
Returns TRUE if display list sharing with another QGLWidget was requested in the constructor, and the GL system was able to provide it; otherwise returns FALSE. The GL system may fail to provide display list sharing if the two QGLWidgets use different formats.
.PP
See also format().
.SH "bool QGLWidget::isValid () const"
Returns TRUE if the widget has a valid GL rendering context; otherwise returns FALSE. A widget will be invalid if the system has no OpenGL support.
.SH "void QGLWidget::makeCurrent ()\fC [virtual]\fR"
Makes this widget the current widget for OpenGL operations, i.e. makes the widget's rendering context the current OpenGL rendering context.
.SH "void QGLWidget::makeOverlayCurrent ()\fC [virtual]\fR"
Makes the overlay context of this widget current. Use this if you need to issue OpenGL commands to the overlay context outside of initializeOverlayGL(), resizeOverlayGL(), and paintOverlayGL().
.PP
Does nothing if this widget has no overlay.
.PP
See also makeCurrent().
.SH "const QGLContext * QGLWidget::overlayContext () const"
Returns the overlay context of this widget, or 0 if this widget has no overlay.
.PP
See also context().
.SH "void QGLWidget::paintEvent ( QPaintEvent * )\fC [virtual protected]\fR"
Handles paint events. Will cause the virtual paintGL() function to be called.
.PP
The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.
.PP
Reimplemented from QWidget.
.SH "void QGLWidget::paintGL ()\fC [virtual protected]\fR"
This virtual function is called whenever the widget needs to be painted. Reimplement it in a subclass.
.PP
There is no need to call makeCurrent() because this has already been done when this function is called.
.SH "void QGLWidget::paintOverlayGL ()\fC [virtual protected]\fR"
This virtual function is used in the same manner as paintGL() 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.
.PP
There is no need to call makeOverlayCurrent() because this has already been done when this function is called.
.SH "void QGLWidget::qglClearColor ( const QColor & c ) const"
Convenience function for specifying the clearing color to OpenGL. Calls glClearColor (in RGBA mode) or glClearIndex (in color-index mode) with the color \fIc\fR. Applies to the current GL context.
.PP
See also qglColor(), QGLContext::currentContext(), and QColor.
.SH "void QGLWidget::qglColor ( const QColor & c ) const"
Convenience function for specifying a drawing color to OpenGL. Calls glColor3 (in RGBA mode) or glIndex (in color-index mode) with the color \fIc\fR. Applies to the current GL context.
.PP
See also qglClearColor(), QGLContext::currentContext(), and QColor.
.SH "QPixmap QGLWidget::renderPixmap ( int w = 0, int h = 0, bool useContext = FALSE )\fC [virtual]\fR"
Renders the current scene on a pixmap and returns the pixmap.
.PP
You can use this method on both visible and invisible QGLWidgets.
.PP
This method will create a pixmap and a temporary QGLContext to render on the pixmap. It will then call initializeGL(), resizeGL(), and paintGL() on this context. Finally, the widget's original GL context is restored.
.PP
The size of the pixmap will be \fIw\fR pixels wide and \fIh\fR pixels high unless one of these parameters is 0 (the default), in which case the pixmap will have the same size as the widget.
.PP
If \fIuseContext\fR 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.
.PP
Overlays are not rendered onto the pixmap.
.PP
If the GL rendering context and the desktop have different bit depths, the result will most likely look surprising.
.PP
Note that the creation of display lists, modifications of the view frustum etc. should be done from within initializeGL(). If this is not done, the temporary QGLContext will not be initialized properly, and the rendered pixmap may be incomplete/corrupted.
.SH "void QGLWidget::renderText ( int x, int y, const QString & str, const QFont & fnt = QFont ( ), int listBase = 2000 )"
Renders the string \fIstr\fR into the GL context of this widget.
.PP
\fIx\fR and \fIy\fR are specified in window coordinates, with the origin in the upper left-hand corner of the window. If \fIfnt\fR 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 qglColor() convenience function), just before the renderText() call. Note that if you have GL_LIGHTING enabled, the string will not appear in the color you want. You should therefore switch lighting off before using renderText().
.PP
\fIlistBase\fR specifies the index of the first display list that is generated by this function. The default value is 2000. 256 display lists will be generated, one for each of the first 256 characters in the font that is used to render the string. If several fonts are used in the same widget, the display lists for these fonts will follow the last generated list. You would normally not have to change this value unless you are using lists in the same range. The lists are deleted when the widget is destroyed.
.PP
Note: This function only works reliably with ASCII strings.
.SH "void QGLWidget::renderText ( double x, double y, double z, const QString & str, const QFont & fnt = QFont ( ), int listBase = 2000 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fIx\fR, \fIy\fR and \fIz\fR 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.
.SH "void QGLWidget::resizeEvent ( QResizeEvent * )\fC [virtual protected]\fR"
Handles resize events. Calls the virtual function resizeGL().
.PP
Reimplemented from QWidget.
.SH "void QGLWidget::resizeGL ( int width, int height )\fC [virtual protected]\fR"
This virtual function is called whenever the widget has been resized. The new size is passed in \fIwidth\fR and \fIheight\fR. Reimplement it in a subclass.
.PP
There is no need to call makeCurrent() because this has already been done when this function is called.
.SH "void QGLWidget::resizeOverlayGL ( int width, int height )\fC [virtual protected]\fR"
This virtual function is used in the same manner as paintGL() 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 \fIwidth\fR and \fIheight\fR. Reimplement it in a subclass.
.PP
There is no need to call makeOverlayCurrent() because this has already been done when this function is called.
.SH "void QGLWidget::setAutoBufferSwap ( bool on )\fC [protected]\fR"
If \fIon\fR is TRUE automatic GL buffer swapping is switched on; otherwise it is switched off.
.PP
If \fIon\fR is TRUE and the widget is using a double-buffered format, the background and foreground GL buffers will automatically be swapped after each paintGL() call.
.PP
The buffer auto-swapping is on by default.
.PP
See also autoBufferSwap(), doubleBuffer(), and swapBuffers().
.SH "void QGLWidget::setColormap ( const QGLColormap & cmap )"
Set the colormap for this widget to \fIcmap\fR. Usually it is only top-level widgets that can have colormaps installed.
.PP
See also colormap().
.SH "void QGLWidget::swapBuffers ()\fC [virtual]\fR"
Swaps the screen contents with an off-screen buffer. This only works if the widget's format specifies double buffer mode.
.PP
Normally, there is no need to explicitly call this function because it is done automatically after each widget repaint, i.e. each time after paintGL() has been executed.
.PP
See also doubleBuffer(), setAutoBufferSwap(), and QGLFormat::setDoubleBuffer().
.SH "void QGLWidget::updateGL ()\fC [virtual slot]\fR"
Updates the widget by calling glDraw().
.SH "void QGLWidget::updateOverlayGL ()\fC [virtual slot]\fR"
Updates the widget's overlay (if any). Will cause the virtual function paintOverlayGL() to be executed.
.PP
The widget's rendering context will become the current context and
initializeGL() will be called if it hasn't already been called.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qglwidget.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qglwidget.3qt) and the Qt
version (3.3.8).
|