1
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
3
<html><head><title>QGLFormat Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
4
a:link { color: #004faf; text-decoration: none }
5
a:visited { color: #672967; text-decoration: none }
6
td.postheader { font-family: sans-serif }
7
tr.address { font-family: sans-serif }
8
body { background: #ffffff; color: black; }
9
</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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGLFormat Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1><p>The QGLFormat class specifies the display format of an OpenGL
10
rendering context. <a href="#details">More...</a></p>
12
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qglformat.html#OpenGLContextProfile-enum">OpenGLContextProfile</a></b> { NoProfile, CoreProfile, CompatibilityProfile }</li><li><div class="fn" />enum <b><a href="qglformat.html#OpenGLVersionFlag-enum">OpenGLVersionFlag</a></b> { OpenGL_Version_None, OpenGL_Version_1_1, OpenGL_Version_1_2, OpenGL_Version_1_3, ..., OpenGL_ES_Version_2_0 }</li><li><div class="fn" />class <b><a href="qglformat-openglversionflags.html">OpenGLVersionFlags</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qglformat.html#QGLFormat">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglformat.html#QGLFormat-2">__init__</a></b> (<i>self</i>, QGL.FormatOptions <i>options</i>, int <i>plane</i> = 0)</li><li><div class="fn" /><b><a href="qglformat.html#QGLFormat-3">__init__</a></b> (<i>self</i>, QGLFormat <i>other</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#accum">accum</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#accumBufferSize">accumBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#alpha">alpha</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#alphaBufferSize">alphaBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#blueBufferSize">blueBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#depth">depth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#depthBufferSize">depthBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#directRendering">directRendering</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#doubleBuffer">doubleBuffer</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#greenBufferSize">greenBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#hasOverlay">hasOverlay</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#majorVersion">majorVersion</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#minorVersion">minorVersion</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#plane">plane</a></b> (<i>self</i>)</li><li><div class="fn" />OpenGLContextProfile <b><a href="qglformat.html#profile">profile</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#redBufferSize">redBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#rgba">rgba</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#sampleBuffers">sampleBuffers</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#samples">samples</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setAccum">setAccum</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setAlpha">setAlpha</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setDepth">setDepth</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setDirectRendering">setDirectRendering</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setOption">setOption</a></b> (<i>self</i>, QGL.FormatOptions <i>opt</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setOverlay">setOverlay</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setPlane">setPlane</a></b> (<i>self</i>, int <i>plane</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setProfile">setProfile</a></b> (<i>self</i>, OpenGLContextProfile <i>profile</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setRedBufferSize">setRedBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setRgba">setRgba</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setSampleBuffers">setSampleBuffers</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setSamples">setSamples</a></b> (<i>self</i>, int <i>numSamples</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setStencil">setStencil</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setStereo">setStereo</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setSwapInterval">setSwapInterval</a></b> (<i>self</i>, int <i>interval</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setVersion">setVersion</a></b> (<i>self</i>, int <i>major</i>, int <i>minor</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#stencil">stencil</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#stencilBufferSize">stencilBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#stereo">stereo</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglformat.html#swapInterval">swapInterval</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglformat.html#testOption">testOption</a></b> (<i>self</i>, QGL.FormatOptions <i>opt</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QGLFormat <b><a href="qglformat.html#defaultFormat">defaultFormat</a></b> ()</li><li><div class="fn" />QGLFormat <b><a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a></b> ()</li><li><div class="fn" />bool <b><a href="qglformat.html#hasOpenGL">hasOpenGL</a></b> ()</li><li><div class="fn" />bool <b><a href="qglformat.html#hasOpenGLOverlays">hasOpenGLOverlays</a></b> ()</li><li><div class="fn" />OpenGLVersionFlags <b><a href="qglformat.html#openGLVersionFlags">openGLVersionFlags</a></b> ()</li><li><div class="fn" /><b><a href="qglformat.html#setDefaultFormat">setDefaultFormat</a></b> (QGLFormat <i>f</i>)</li><li><div class="fn" /><b><a href="qglformat.html#setDefaultOverlayFormat">setDefaultOverlayFormat</a></b> (QGLFormat <i>f</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qglformat.html#__eq__">__eq__</a></b> (<i>self</i>, QGLFormat)</li><li><div class="fn" />bool <b><a href="qglformat.html#__ne__">__ne__</a></b> (<i>self</i>, QGLFormat)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGLFormat class specifies the display format of an OpenGL
13
rendering context.</p>
14
<p>A display format has several characteristics:</p>
16
<li><a href="qglformat.html#setDoubleBuffer">Double or single
18
<li><a href="qglformat.html#setDepth">Depth buffer.</a></li>
19
<li><a href="qglformat.html#setRgba">RGBA or color index
21
<li><a href="qglformat.html#setAlpha">Alpha channel.</a></li>
22
<li><a href="qglformat.html#setAccum">Accumulation buffer.</a></li>
23
<li><a href="qglformat.html#setStencil">Stencil buffer.</a></li>
24
<li><a href="qglformat.html#setStereo">Stereo buffers.</a></li>
25
<li><a href="qglformat.html#setDirectRendering">Direct
27
<li><a href="qglformat.html#setOverlay">Presence of an
29
<li><a href="qglformat.html#setPlane">Plane of an overlay.</a></li>
30
<li><a href="qglformat.html#setSampleBuffers">Multisample
33
<p>You can also specify preferred bit depths for the color buffer,
34
depth buffer, alpha buffer, accumulation buffer and the stencil
35
buffer with the functions: <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(),
36
<a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>(),
37
<a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>(),
38
<a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>(),
39
<a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>() and
40
<a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
41
<p>Note that even if you specify that you prefer a 32 bit depth
42
buffer (e.g. with setDepthBufferSize(32)), the format that is
43
chosen may not have a 32 bit depth buffer, even if there is a
44
format available with a 32 bit depth buffer. The main reason for
45
this is how the system dependant picking algorithms work on the
46
different platforms, and some format options may have higher
47
precedence than others.</p>
48
<p>You create and tell a QGLFormat object what rendering options
49
you want from an OpenGL rendering context.</p>
50
<p>OpenGL drivers or accelerated hardware may or may not support
51
advanced features such as alpha channel or stereographic viewing.
52
If you request some features that the driver/hardware does not
53
provide when you create a <a href="qglwidget.html">QGLWidget</a>,
54
you will get a rendering context with the nearest subset of
56
<p>There are different ways to define the display characteristics
57
of a rendering context. One is to create a QGLFormat and make it
58
the default for the entire application:</p>
60
<span class="type">QGLFormat</span> fmt;
61
fmt<span class="operator">.</span><a href="qglformat.html#setAlpha">setAlpha</a>(<span class="keyword">true</span>);
62
fmt<span class="operator">.</span><a href="qglformat.html#setStereo">setStereo</a>(<span class="keyword">true</span>);
63
<span class="type">QGLFormat</span><span class="operator">.</span><a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>(fmt);
65
<p>Or you can specify the desired format when creating an object of
66
your <a href="qglwidget.html">QGLWidget</a> subclass:</p>
68
<span class="type">QGLFormat</span> fmt;
69
fmt<span class="operator">.</span><a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a>(<span class="keyword">false</span>); <span class="comment">// single buffer</span>
70
fmt<span class="operator">.</span><a href="qglformat.html#setDirectRendering">setDirectRendering</a>(<span class="keyword">false</span>); <span class="comment">// software rendering</span>
71
MyGLWidget<span class="operator">*</span> myWidget <span class="operator">=</span> <span class="keyword">new</span> MyGLWidget(fmt<span class="operator">,</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
73
<p>After the widget has been created, you can find out which of the
74
requested features the system was able to provide:</p>
76
<span class="type">QGLFormat</span> fmt;
77
fmt<span class="operator">.</span><a href="qglformat.html#setOverlay">setOverlay</a>(<span class="keyword">true</span>);
78
fmt<span class="operator">.</span><a href="qglformat.html#setStereo">setStereo</a>(<span class="keyword">true</span>);
79
MyGLWidget<span class="operator">*</span> myWidget <span class="operator">=</span> <span class="keyword">new</span> MyGLWidget(fmt<span class="operator">,</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
80
<span class="keyword">if</span> (<span class="operator">!</span>myWidget<span class="operator">-</span><span class="operator">></span>format()<span class="operator">.</span>stereo()) {
81
<span class="comment">// ok, goggles off</span>
82
<span class="keyword">if</span> (<span class="operator">!</span>myWidget<span class="operator">-</span><span class="operator">></span>format()<span class="operator">.</span>hasOverlay()) {
83
<a href="qtcore.html#qFatal">qFatal</a>(<span class="string">"Cool hardware required"</span>);
87
<div class="LegaleseLeft">
88
<p>OpenGL is a trademark of Silicon Graphics, Inc. in the United
89
States and other countries.</p>
91
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="OpenGLContextProfile-enum" />QGLFormat.OpenGLContextProfile</h3><p>This enum describes the OpenGL context profiles that can be
92
specified for contexts implementing OpenGL version 3.2 or higher.
93
These profiles are different from OpenGL ES profiles.</p>
94
<table class="valuelist">
95
<tr class="odd" valign="top">
96
<th class="tblConst">Constant</th>
97
<th class="tblval">Value</th>
98
<th class="tbldscr">Description</th>
101
<td class="topAlign"><tt>QGLFormat.NoProfile</tt></td>
102
<td class="topAlign"><tt>0</tt></td>
103
<td class="topAlign">OpenGL version is lower than 3.2.</td>
106
<td class="topAlign"><tt>QGLFormat.CoreProfile</tt></td>
107
<td class="topAlign"><tt>1</tt></td>
108
<td class="topAlign">Functionality deprecated in OpenGL version 3.0
109
is not available.</td>
112
<td class="topAlign"><tt>QGLFormat.CompatibilityProfile</tt></td>
113
<td class="topAlign"><tt>2</tt></td>
114
<td class="topAlign">Functionality from earlier OpenGL versions is
118
<p>This enum was introduced or modified in Qt 4.7.</p>
121
<h3 class="fn"><a name="OpenGLVersionFlag-enum" />QGLFormat.OpenGLVersionFlag</h3><p>This enum describes the various OpenGL versions that are
122
recognized by Qt. Use the <a href="qglformat.html#openGLVersionFlags">QGLFormat.openGLVersionFlags</a>()
123
function to identify which versions that are supported at
125
<table class="valuelist">
126
<tr class="odd" valign="top">
127
<th class="tblConst">Constant</th>
128
<th class="tblval">Value</th>
129
<th class="tbldscr">Description</th>
132
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_None</tt></td>
133
<td class="topAlign"><tt>0x00000000</tt></td>
134
<td class="topAlign">If no OpenGL is present or if no OpenGL
135
context is current.</td>
138
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_1_1</tt></td>
139
<td class="topAlign"><tt>0x00000001</tt></td>
140
<td class="topAlign">OpenGL version 1.1 or higher is present.</td>
143
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_1_2</tt></td>
144
<td class="topAlign"><tt>0x00000002</tt></td>
145
<td class="topAlign">OpenGL version 1.2 or higher is present.</td>
148
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_1_3</tt></td>
149
<td class="topAlign"><tt>0x00000004</tt></td>
150
<td class="topAlign">OpenGL version 1.3 or higher is present.</td>
153
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_1_4</tt></td>
154
<td class="topAlign"><tt>0x00000008</tt></td>
155
<td class="topAlign">OpenGL version 1.4 or higher is present.</td>
158
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_1_5</tt></td>
159
<td class="topAlign"><tt>0x00000010</tt></td>
160
<td class="topAlign">OpenGL version 1.5 or higher is present.</td>
163
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_2_0</tt></td>
164
<td class="topAlign"><tt>0x00000020</tt></td>
165
<td class="topAlign">OpenGL version 2.0 or higher is present. Note
166
that version 2.0 supports all the functionality of version
170
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_2_1</tt></td>
171
<td class="topAlign"><tt>0x00000040</tt></td>
172
<td class="topAlign">OpenGL version 2.1 or higher is present.</td>
175
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_3_0</tt></td>
176
<td class="topAlign"><tt>0x00001000</tt></td>
177
<td class="topAlign">OpenGL version 3.0 or higher is present.</td>
180
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_3_1</tt></td>
181
<td class="topAlign"><tt>0x00002000</tt></td>
182
<td class="topAlign">OpenGL version 3.1 or higher is present. Note
183
that OpenGL version 3.1 or higher does not necessarily support all
184
the features of version 3.0 and lower.</td>
187
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_3_2</tt></td>
188
<td class="topAlign"><tt>0x00004000</tt></td>
189
<td class="topAlign">OpenGL version 3.2 or higher is present.</td>
192
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_3_3</tt></td>
193
<td class="topAlign"><tt>0x00008000</tt></td>
194
<td class="topAlign">OpenGL version 3.3 or higher is present.</td>
197
<td class="topAlign"><tt>QGLFormat.OpenGL_Version_4_0</tt></td>
198
<td class="topAlign"><tt>0x00010000</tt></td>
199
<td class="topAlign">OpenGL version 4.0 or higher is present.</td>
202
<td class="topAlign">
203
<tt>QGLFormat.OpenGL_ES_CommonLite_Version_1_0</tt></td>
204
<td class="topAlign"><tt>0x00000100</tt></td>
205
<td class="topAlign">OpenGL ES version 1.0 Common Lite or higher is
209
<td class="topAlign">
210
<tt>QGLFormat.OpenGL_ES_Common_Version_1_0</tt></td>
211
<td class="topAlign"><tt>0x00000080</tt></td>
212
<td class="topAlign">OpenGL ES version 1.0 Common or higher is
213
present. The Common profile supports all the features of Common
217
<td class="topAlign">
218
<tt>QGLFormat.OpenGL_ES_CommonLite_Version_1_1</tt></td>
219
<td class="topAlign"><tt>0x00000400</tt></td>
220
<td class="topAlign">OpenGL ES version 1.1 Common Lite or higher is
224
<td class="topAlign">
225
<tt>QGLFormat.OpenGL_ES_Common_Version_1_1</tt></td>
226
<td class="topAlign"><tt>0x00000200</tt></td>
227
<td class="topAlign">OpenGL ES version 1.1 Common or higher is
228
present. The Common profile supports all the features of Common
232
<td class="topAlign"><tt>QGLFormat.OpenGL_ES_Version_2_0</tt></td>
233
<td class="topAlign"><tt>0x00000800</tt></td>
234
<td class="topAlign">OpenGL ES version 2.0 or higher is present.
235
Note that OpenGL ES version 2.0 does not support all the features
236
of OpenGL ES 1.x. So if OpenGL_ES_Version_2_0 is returned, none of
237
the ES 1.x flags are returned.</td>
240
<p>See also <a href="http://www.opengl.org">http://www.opengl.org</a> for more
241
information about the different revisions of OpenGL.</p>
242
<p>This enum was introduced or modified in Qt 4.2.</p>
243
<p>The OpenGLVersionFlags type is a typedef for <a href="qflags.html">QFlags</a><OpenGLVersionFlag>. It stores an OR
244
combination of OpenGLVersionFlag values.</p>
245
<p><b>See also</b> <a href="qglformat.html#openGLVersionFlags">openGLVersionFlags</a>().</p>
246
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGLFormat" />QGLFormat.__init__ (<i>self</i>)</h3><p>Constructs a <a href="qglformat.html">QGLFormat</a> object with
247
the following default settings:</p>
249
<li><a href="qglformat.html#setDoubleBuffer">Double buffer:</a>
251
<li><a href="qglformat.html#setDepth">Depth buffer:</a>
253
<li><a href="qglformat.html#setRgba">RGBA:</a> Enabled (i.e., color
254
index disabled).</li>
255
<li><a href="qglformat.html#setAlpha">Alpha channel:</a>
257
<li><a href="qglformat.html#setAccum">Accumulator buffer:</a>
259
<li><a href="qglformat.html#setStencil">Stencil buffer:</a>
261
<li><a href="qglformat.html#setStereo">Stereo:</a> Disabled.</li>
262
<li><a href="qglformat.html#setDirectRendering">Direct
263
rendering:</a> Enabled.</li>
264
<li><a href="qglformat.html#setOverlay">Overlay:</a> Disabled.</li>
265
<li><a href="qglformat.html#setPlane">Plane:</a> 0 (i.e., normal
267
<li><a href="qglformat.html#setSampleBuffers">Multisample
268
buffers:</a> Disabled.</li>
272
<h3 class="fn"><a name="QGLFormat-2" />QGLFormat.__init__ (<i>self</i>, <a href="qgl-formatoptions.html">QGL.FormatOptions</a> <i>options</i>, int <i>plane</i> = 0)</h3><p>Creates a <a href="qglformat.html">QGLFormat</a> object that is
273
a copy of the current <a href="qglformat.html#defaultFormat">defaultFormat</a>().</p>
274
<p>If <i>options</i> is not 0, the default format is modified by
275
the specified format options. The <i>options</i> parameter should
276
be <a href="qgl.html#FormatOption-enum">QGL.FormatOption</a>
277
values OR'ed together.</p>
278
<p>This constructor makes it easy to specify a certain desired
279
format in classes derived from <a href="qglwidget.html">QGLWidget</a>, for example:</p>
281
<span class="comment">// The rendering in MyGLWidget depends on using</span>
282
<span class="comment">// stencil buffer and alpha channel</span>
283
MyGLWidget<span class="operator">.</span>MyGLWidget(<span class="type"><a href="qwidget.html">QWidget</a></span><span class="operator">*</span> parent)
284
: <span class="type"><a href="qglwidget.html">QGLWidget</a></span>(<span class="type"><a href="qglformat.html">QGLFormat</a></span>(QGL<span class="operator">.</span>StencilBuffer <span class="operator">|</span> QGL<span class="operator">.</span>AlphaChannel)<span class="operator">,</span> parent)
286
<span class="keyword">if</span> (<span class="operator">!</span>format()<span class="operator">.</span>stencil())
287
<a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"Could not get stencil buffer; results will be suboptimal"</span>);
288
<span class="keyword">if</span> (<span class="operator">!</span>format()<span class="operator">.</span>alpha())
289
<a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"Could not get alpha channel; results will be suboptimal"</span>);
290
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
293
<p>Note that there are <a href="qgl.html#FormatOption-enum">QGL.FormatOption</a> values to turn
294
format settings both on and off, e.g. <a href="qgl.html#FormatOption-enum">QGL.DepthBuffer</a> and <a href="qgl.html#FormatOption-enum">QGL.NoDepthBuffer</a>, <a href="qgl.html#FormatOption-enum">QGL.DirectRendering</a> and <a href="qgl.html#FormatOption-enum">QGL.IndirectRendering</a>, etc.</p>
295
<p>The <i>plane</i> parameter defaults to 0 and is the plane which
296
this format should be associated with. Not all OpenGL
297
implementations supports overlay/underlay rendering planes.</p>
298
<p><b>See also</b> <a href="qglformat.html#defaultFormat">defaultFormat</a>(), <a href="qglformat.html#setOption">setOption</a>(), and <a href="qglformat.html#setPlane">setPlane</a>().</p>
301
<h3 class="fn"><a name="QGLFormat-3" />QGLFormat.__init__ (<i>self</i>, <a href="qglformat.html">QGLFormat</a> <i>other</i>)</h3><p>Constructs a copy of <i>other</i>.</p>
304
<h3 class="fn"><a name="accum" />bool QGLFormat.accum (<i>self</i>)</h3><p>Returns true if the accumulation buffer is enabled; otherwise
305
returns false. The accumulation buffer is disabled by default.</p>
306
<p><b>See also</b> <a href="qglformat.html#setAccum">setAccum</a>()
307
and <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>().</p>
310
<h3 class="fn"><a name="accumBufferSize" />int QGLFormat.accumBufferSize (<i>self</i>)</h3><p>Returns the accumulation buffer size.</p>
311
<p><b>See also</b> <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>(),
312
<a href="qglformat.html#accum">accum</a>(), and <a href="qglformat.html#setAccum">setAccum</a>().</p>
315
<h3 class="fn"><a name="alpha" />bool QGLFormat.alpha (<i>self</i>)</h3><p>Returns true if the alpha buffer in the framebuffer is enabled;
316
otherwise returns false. The alpha buffer is disabled by
318
<p><b>See also</b> <a href="qglformat.html#setAlpha">setAlpha</a>()
319
and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
322
<h3 class="fn"><a name="alphaBufferSize" />int QGLFormat.alphaBufferSize (<i>self</i>)</h3><p>Returns the alpha buffer size.</p>
323
<p><b>See also</b> <a href="qglformat.html#alpha">alpha</a>(),
324
<a href="qglformat.html#setAlpha">setAlpha</a>(), and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
327
<h3 class="fn"><a name="blueBufferSize" />int QGLFormat.blueBufferSize (<i>self</i>)</h3><p>Returns the blue buffer size.</p>
328
<p>This function was introduced in Qt 4.2.</p>
329
<p><b>See also</b> <a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>().</p>
332
<h3 class="fn"><a name="defaultFormat" /><a href="qglformat.html">QGLFormat</a> QGLFormat.defaultFormat ()</h3><p>Returns the default <a href="qglformat.html">QGLFormat</a> for
333
the application. All <a href="qglwidget.html">QGLWidget</a> objects
334
that are created use this format unless another format is
335
specified, e.g. when they are constructed.</p>
336
<p>If no special default format has been set using <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>(), the
337
default format is the same as that created with <a href="qglformat.html#QGLFormat">QGLFormat</a>().</p>
338
<p><b>See also</b> <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>().</p>
341
<h3 class="fn"><a name="defaultOverlayFormat" /><a href="qglformat.html">QGLFormat</a> QGLFormat.defaultOverlayFormat ()</h3><p>Returns the default <a href="qglformat.html">QGLFormat</a> for
342
overlay contexts.</p>
343
<p>The default overlay format is:</p>
345
<li><a href="qglformat.html#setDoubleBuffer">Double buffer:</a>
347
<li><a href="qglformat.html#setDepth">Depth buffer:</a>
349
<li><a href="qglformat.html#setRgba">RGBA:</a> Disabled (i.e.,
350
color index enabled).</li>
351
<li><a href="qglformat.html#setAlpha">Alpha channel:</a>
353
<li><a href="qglformat.html#setAccum">Accumulator buffer:</a>
355
<li><a href="qglformat.html#setStencil">Stencil buffer:</a>
357
<li><a href="qglformat.html#setStereo">Stereo:</a> Disabled.</li>
358
<li><a href="qglformat.html#setDirectRendering">Direct
359
rendering:</a> Enabled.</li>
360
<li><a href="qglformat.html#setOverlay">Overlay:</a> Disabled.</li>
361
<li><a href="qglformat.html#setSampleBuffers">Multisample
362
buffers:</a> Disabled.</li>
363
<li><a href="qglformat.html#setPlane">Plane:</a> 1 (i.e., first
366
<p><b>See also</b> <a href="qglformat.html#setDefaultOverlayFormat">setDefaultOverlayFormat</a>()
367
and <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>().</p>
370
<h3 class="fn"><a name="depth" />bool QGLFormat.depth (<i>self</i>)</h3><p>Returns true if the depth buffer is enabled; otherwise returns
371
false. The depth buffer is enabled by default.</p>
372
<p><b>See also</b> <a href="qglformat.html#setDepth">setDepth</a>()
373
and <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
376
<h3 class="fn"><a name="depthBufferSize" />int QGLFormat.depthBufferSize (<i>self</i>)</h3><p>Returns the depth buffer size.</p>
377
<p><b>See also</b> <a href="qglformat.html#depth">depth</a>(),
378
<a href="qglformat.html#setDepth">setDepth</a>(), and <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
381
<h3 class="fn"><a name="directRendering" />bool QGLFormat.directRendering (<i>self</i>)</h3><p>Returns true if direct rendering is enabled; otherwise returns
383
<p>Direct rendering is enabled by default.</p>
384
<p><b>See also</b> <a href="qglformat.html#setDirectRendering">setDirectRendering</a>().</p>
387
<h3 class="fn"><a name="doubleBuffer" />bool QGLFormat.doubleBuffer (<i>self</i>)</h3><p>Returns true if double buffering is enabled; otherwise returns
388
false. Double buffering is enabled by default.</p>
389
<p><b>See also</b> <a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a>().</p>
392
<h3 class="fn"><a name="greenBufferSize" />int QGLFormat.greenBufferSize (<i>self</i>)</h3><p>Returns the green buffer size.</p>
393
<p>This function was introduced in Qt 4.2.</p>
394
<p><b>See also</b> <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>().</p>
397
<h3 class="fn"><a name="hasOpenGL" />bool QGLFormat.hasOpenGL ()</h3><p>Returns true if the window system has any OpenGL support;
398
otherwise returns false.</p>
399
<p><b>Warning:</b> This function must not be called until the
400
<a href="qapplication.html">QApplication</a> object has been
404
<h3 class="fn"><a name="hasOpenGLOverlays" />bool QGLFormat.hasOpenGLOverlays ()</h3><p>Returns true if the window system supports OpenGL overlays;
405
otherwise returns false.</p>
406
<p><b>Warning:</b> This function must not be called until the
407
<a href="qapplication.html">QApplication</a> object has been
411
<h3 class="fn"><a name="hasOverlay" />bool QGLFormat.hasOverlay (<i>self</i>)</h3><p>Returns true if overlay plane is enabled; otherwise returns
413
<p>Overlay is disabled by default.</p>
414
<p><b>See also</b> <a href="qglformat.html#setOverlay">setOverlay</a>().</p>
417
<h3 class="fn"><a name="majorVersion" />int QGLFormat.majorVersion (<i>self</i>)</h3><p>Returns the OpenGL major version.</p>
418
<p>This function was introduced in Qt 4.7.</p>
419
<p><b>See also</b> <a href="qglformat.html#setVersion">setVersion</a>() and <a href="qglformat.html#minorVersion">minorVersion</a>().</p>
422
<h3 class="fn"><a name="minorVersion" />int QGLFormat.minorVersion (<i>self</i>)</h3><p>Returns the OpenGL minor version.</p>
423
<p>This function was introduced in Qt 4.7.</p>
424
<p><b>See also</b> <a href="qglformat.html#setVersion">setVersion</a>() and <a href="qglformat.html#majorVersion">majorVersion</a>().</p>
427
<h3 class="fn"><a name="openGLVersionFlags" /><a href="qglformat-openglversionflags.html">OpenGLVersionFlags</a> QGLFormat.openGLVersionFlags ()</h3><p>Identifies, at runtime, which OpenGL versions that are supported
428
by the current platform.</p>
429
<p>Note that if OpenGL version 1.5 is supported, its predecessors
430
(i.e., version 1.4 and lower) are also supported. To identify the
431
support of a particular feature, like multi texturing, test for the
432
version in which the feature was first introduced (i.e., version
433
1.3 in the case of multi texturing) to adapt to the largest
434
possible group of runtime platforms.</p>
435
<p>This function needs a valid current OpenGL context to work;
436
otherwise it will return <a href="qglformat.html#OpenGLVersionFlag-enum">OpenGL_Version_None</a>.</p>
437
<p>This function was introduced in Qt 4.2.</p>
438
<p><b>See also</b> <a href="qglformat.html#hasOpenGL">hasOpenGL</a>() and <a href="qglformat.html#hasOpenGLOverlays">hasOpenGLOverlays</a>().</p>
441
<h3 class="fn"><a name="plane" />int QGLFormat.plane (<i>self</i>)</h3><p>Returns the plane of this format. The default for normal formats
442
is 0, which means the normal plane. The default for overlay formats
443
is 1, which is the first overlay plane.</p>
444
<p><b>See also</b> <a href="qglformat.html#setPlane">setPlane</a>()
445
and <a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a>().</p>
448
<h3 class="fn"><a name="profile" /><a href="qglformat.html#OpenGLContextProfile-enum">OpenGLContextProfile</a> QGLFormat.profile (<i>self</i>)</h3><p>Returns the OpenGL context profile.</p>
449
<p>This function was introduced in Qt 4.7.</p>
450
<p><b>See also</b> <a href="qglformat.html#setProfile">setProfile</a>().</p>
453
<h3 class="fn"><a name="redBufferSize" />int QGLFormat.redBufferSize (<i>self</i>)</h3><p>Returns the red buffer size.</p>
454
<p>This function was introduced in Qt 4.2.</p>
455
<p><b>See also</b> <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>().</p>
458
<h3 class="fn"><a name="rgba" />bool QGLFormat.rgba (<i>self</i>)</h3><p>Returns true if RGBA color mode is set. Returns false if color
459
index mode is set. The default color mode is RGBA.</p>
460
<p><b>See also</b> <a href="qglformat.html#setRgba">setRgba</a>().</p>
463
<h3 class="fn"><a name="sampleBuffers" />bool QGLFormat.sampleBuffers (<i>self</i>)</h3><p>Returns true if multisample buffer support is enabled; otherwise
465
<p>The multisample buffer is disabled by default.</p>
466
<p><b>See also</b> <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>().</p>
469
<h3 class="fn"><a name="samples" />int QGLFormat.samples (<i>self</i>)</h3><p>Returns the number of samples per pixel when multisampling is
470
enabled. By default, the highest number of samples that is
471
available is used.</p>
472
<p><b>See also</b> <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>(), <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), and <a href="qglformat.html#setSamples">setSamples</a>().</p>
475
<h3 class="fn"><a name="setAccum" />QGLFormat.setAccum (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables the accumulation buffer;
476
otherwise disables the accumulation buffer.</p>
477
<p>The accumulation buffer is disabled by default.</p>
478
<p>The accumulation buffer is used to create blur effects and
479
multiple exposures.</p>
480
<p><b>See also</b> <a href="qglformat.html#accum">accum</a>() and
481
<a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>().</p>
484
<h3 class="fn"><a name="setAccumBufferSize" />QGLFormat.setAccumBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred accumulation buffer size, where <i>size</i> is
485
the bit depth for each RGBA component.</p>
486
<p><b>See also</b> <a href="qglformat.html#accum">accum</a>(),
487
<a href="qglformat.html#setAccum">setAccum</a>(), and <a href="qglformat.html#accumBufferSize">accumBufferSize</a>().</p>
490
<h3 class="fn"><a name="setAlpha" />QGLFormat.setAlpha (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables the alpha buffer; otherwise
491
disables the alpha buffer.</p>
492
<p>The alpha buffer is disabled by default.</p>
493
<p>The alpha buffer is typically used for implementing transparency
494
or translucency. The A in RGBA specifies the transparency of a
496
<p><b>See also</b> <a href="qglformat.html#alpha">alpha</a>() and
497
<a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
500
<h3 class="fn"><a name="setAlphaBufferSize" />QGLFormat.setAlphaBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred alpha buffer size to <i>size</i>. This
501
function implicitly enables the alpha channel.</p>
502
<p><b>See also</b> <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(), and
503
<a href="qglformat.html#alphaBufferSize">alphaBufferSize</a>().</p>
506
<h3 class="fn"><a name="setBlueBufferSize" />QGLFormat.setBlueBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred blue buffer size to <i>size</i>.</p>
507
<p>This function was introduced in Qt 4.2.</p>
508
<p><b>See also</b> <a href="qglformat.html#blueBufferSize">blueBufferSize</a>(), <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(), and
509
<a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
512
<h3 class="fn"><a name="setDefaultFormat" />QGLFormat.setDefaultFormat (<a href="qglformat.html">QGLFormat</a> <i>f</i>)</h3><p>Sets a new default <a href="qglformat.html">QGLFormat</a> for
513
the application to <i>f</i>. For example, to set single buffering
514
as the default instead of double buffering, your main() might
515
contain code like this:</p>
517
<span class="type"><a href="qapplication.html">QApplication</a></span> a(argc<span class="operator">,</span> argv);
518
<span class="type"><a href="qglformat.html">QGLFormat</a></span> f;
519
f<span class="operator">.</span><a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a>(<span class="keyword">false</span>);
520
<span class="type"><a href="qglformat.html">QGLFormat</a></span><span class="operator">.</span>setDefaultFormat(f);
522
<p><b>See also</b> <a href="qglformat.html#defaultFormat">defaultFormat</a>().</p>
525
<h3 class="fn"><a name="setDefaultOverlayFormat" />QGLFormat.setDefaultOverlayFormat (<a href="qglformat.html">QGLFormat</a> <i>f</i>)</h3><p>Sets a new default <a href="qglformat.html">QGLFormat</a> for
526
overlay contexts to <i>f</i>. This format is used whenever a
527
<a href="qglwidget.html">QGLWidget</a> is created with a format
528
that <a href="qglformat.html#hasOverlay">hasOverlay</a>()
530
<p>For example, to get a double buffered overlay context (if
531
available), use code like this:</p>
533
<span class="type"><a href="qglformat.html">QGLFormat</a></span> f <span class="operator">=</span> <span class="type"><a href="qglformat.html">QGLFormat</a></span><span class="operator">.</span><a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a>();
534
f<span class="operator">.</span><a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a>(<span class="keyword">true</span>);
535
<span class="type"><a href="qglformat.html">QGLFormat</a></span><span class="operator">.</span>setDefaultOverlayFormat(f);
537
<p>As usual, you can find out after widget creation whether the
538
underlying OpenGL system was able to provide the requested
541
<span class="comment">// ...continued from above</span>
542
MyGLWidget<span class="operator">*</span> myWidget <span class="operator">=</span> <span class="keyword">new</span> MyGLWidget(<span class="type"><a href="qglformat.html">QGLFormat</a></span>(QGL<span class="operator">.</span>HasOverlay)<span class="operator">,</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
543
<span class="keyword">if</span> (myWidget<span class="operator">-</span><span class="operator">></span>format()<span class="operator">.</span>hasOverlay()) {
544
<span class="comment">// Yes, we got an overlay, let's check _its_ format:</span>
545
<span class="type"><a href="qglcontext.html">QGLContext</a></span><span class="operator">*</span> olContext <span class="operator">=</span> myWidget<span class="operator">-</span><span class="operator">></span>overlayContext();
546
<span class="keyword">if</span> (olContext<span class="operator">-</span><span class="operator">></span>format()<span class="operator">.</span>doubleBuffer())
547
; <span class="comment">// yes, we got a double buffered overlay</span>
548
<span class="keyword">else</span>
549
; <span class="comment">// no, only single buffered overlays are available</span>
552
<p><b>See also</b> <a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a>().</p>
555
<h3 class="fn"><a name="setDepth" />QGLFormat.setDepth (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables the depth buffer; otherwise
556
disables the depth buffer.</p>
557
<p>The depth buffer is enabled by default.</p>
558
<p>The purpose of a depth buffer (or Z-buffering) is to remove
559
hidden surfaces. Pixels are assigned Z values based on the distance
560
to the viewer. A pixel with a high Z value is closer to the viewer
561
than a pixel with a low Z value. This information is used to decide
562
whether to draw a pixel or not.</p>
563
<p><b>See also</b> <a href="qglformat.html#depth">depth</a>() and
564
<a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
567
<h3 class="fn"><a name="setDepthBufferSize" />QGLFormat.setDepthBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the minimum depth buffer size to <i>size</i>.</p>
568
<p><b>See also</b> <a href="qglformat.html#depthBufferSize">depthBufferSize</a>(), <a href="qglformat.html#setDepth">setDepth</a>(), and <a href="qglformat.html#depth">depth</a>().</p>
571
<h3 class="fn"><a name="setDirectRendering" />QGLFormat.setDirectRendering (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables direct rendering; otherwise
572
disables direct rendering.</p>
573
<p>Direct rendering is enabled by default.</p>
574
<p>Enabling this option will make OpenGL bypass the underlying
575
window system and render directly from hardware to the screen, if
576
this is supported by the system.</p>
577
<p><b>See also</b> <a href="qglformat.html#directRendering">directRendering</a>().</p>
580
<h3 class="fn"><a name="setDoubleBuffer" />QGLFormat.setDoubleBuffer (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true sets double buffering; otherwise sets
581
single buffering.</p>
582
<p>Double buffering is enabled by default.</p>
583
<p>Double buffering is a technique where graphics are rendered on
584
an off-screen buffer and not directly to the screen. When the
585
drawing has been completed, the program calls a swapBuffers()
586
function to exchange the screen contents with the buffer. The
587
result is flicker-free drawing and often better performance.</p>
588
<p>Note that single buffered contexts are currently not supported
590
<p><b>See also</b> <a href="qglformat.html#doubleBuffer">doubleBuffer</a>(), <a href="qglcontext.html#swapBuffers">QGLContext.swapBuffers</a>(), and
591
<a href="qglwidget.html#swapBuffers">QGLWidget.swapBuffers</a>().</p>
594
<h3 class="fn"><a name="setGreenBufferSize" />QGLFormat.setGreenBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred green buffer size to <i>size</i>.</p>
595
<p>This function was introduced in Qt 4.2.</p>
596
<p><b>See also</b> <a href="qglformat.html#greenBufferSize">greenBufferSize</a>(), <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>(), and
597
<a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
600
<h3 class="fn"><a name="setOption" />QGLFormat.setOption (<i>self</i>, <a href="qgl-formatoptions.html">QGL.FormatOptions</a> <i>opt</i>)</h3><p>Sets the format option to <i>opt</i>.</p>
601
<p><b>See also</b> <a href="qglformat.html#testOption">testOption</a>().</p>
604
<h3 class="fn"><a name="setOverlay" />QGLFormat.setOverlay (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables an overlay plane; otherwise
605
disables the overlay plane.</p>
606
<p>Enabling the overlay plane will cause <a href="qglwidget.html">QGLWidget</a> to create an additional context in
607
an overlay plane. See the <a href="qglwidget.html">QGLWidget</a>
608
documentation for further information.</p>
609
<p><b>See also</b> <a href="qglformat.html#hasOverlay">hasOverlay</a>().</p>
612
<h3 class="fn"><a name="setPlane" />QGLFormat.setPlane (<i>self</i>, int <i>plane</i>)</h3><p>Sets the requested plane to <i>plane</i>. 0 is the normal plane,
613
1 is the first overlay plane, 2 is the second overlay plane, etc.;
614
-1, -2, etc. are underlay planes.</p>
615
<p>Note that in contrast to other format specifications, the plane
616
specifications will be matched exactly. This means that if you
617
specify a plane that the underlying OpenGL system cannot provide,
618
an <a href="qglwidget.html#isValid">invalid</a> <a href="qglwidget.html">QGLWidget</a> will be created.</p>
619
<p><b>See also</b> <a href="qglformat.html#plane">plane</a>().</p>
622
<h3 class="fn"><a name="setProfile" />QGLFormat.setProfile (<i>self</i>, <a href="qglformat.html#OpenGLContextProfile-enum">OpenGLContextProfile</a> <i>profile</i>)</h3><p>Set the OpenGL context profile to <i>profile</i>. The
623
<i>profile</i> is ignored if the requested OpenGL version is less
625
<p>This function was introduced in Qt 4.7.</p>
626
<p><b>See also</b> <a href="qglformat.html#profile">profile</a>().</p>
629
<h3 class="fn"><a name="setRedBufferSize" />QGLFormat.setRedBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred red buffer size to <i>size</i>.</p>
630
<p>This function was introduced in Qt 4.2.</p>
631
<p><b>See also</b> <a href="qglformat.html#redBufferSize">redBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(),
632
<a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>(),
633
and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
636
<h3 class="fn"><a name="setRgba" />QGLFormat.setRgba (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true sets RGBA mode. If <i>enable</i> is
637
false sets color index mode.</p>
638
<p>The default color mode is RGBA.</p>
639
<p>RGBA is the preferred mode for most OpenGL applications. In RGBA
640
color mode you specify colors as red + green + blue + alpha
642
<p>In color index mode you specify an index into a color lookup
644
<p><b>See also</b> <a href="qglformat.html#rgba">rgba</a>().</p>
647
<h3 class="fn"><a name="setSampleBuffers" />QGLFormat.setSampleBuffers (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true, a GL context with multisample buffer
648
support is picked; otherwise ignored.</p>
649
<p><b>See also</b> <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), <a href="qglformat.html#setSamples">setSamples</a>(), and <a href="qglformat.html#samples">samples</a>().</p>
652
<h3 class="fn"><a name="setSamples" />QGLFormat.setSamples (<i>self</i>, int <i>numSamples</i>)</h3><p>Set the preferred number of samples per pixel when multisampling
653
is enabled to <i>numSamples</i>. By default, the highest number of
654
samples available is used.</p>
655
<p><b>See also</b> <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>(), <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), and <a href="qglformat.html#samples">samples</a>().</p>
658
<h3 class="fn"><a name="setStencil" />QGLFormat.setStencil (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables the stencil buffer; otherwise
659
disables the stencil buffer.</p>
660
<p>The stencil buffer is enabled by default.</p>
661
<p>The stencil buffer masks certain parts of the drawing area so
662
that masked parts are not drawn on.</p>
663
<p><b>See also</b> <a href="qglformat.html#stencil">stencil</a>()
664
and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
667
<h3 class="fn"><a name="setStencilBufferSize" />QGLFormat.setStencilBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Set the preferred stencil buffer size to <i>size</i>.</p>
668
<p><b>See also</b> <a href="qglformat.html#stencilBufferSize">stencilBufferSize</a>(),
669
<a href="qglformat.html#setStencil">setStencil</a>(), and <a href="qglformat.html#stencil">stencil</a>().</p>
672
<h3 class="fn"><a name="setStereo" />QGLFormat.setStereo (<i>self</i>, bool <i>enable</i>)</h3><p>If <i>enable</i> is true enables stereo buffering; otherwise
673
disables stereo buffering.</p>
674
<p>Stereo buffering is disabled by default.</p>
675
<p>Stereo buffering provides extra color buffers to generate
676
left-eye and right-eye images.</p>
677
<p><b>See also</b> <a href="qglformat.html#stereo">stereo</a>().</p>
680
<h3 class="fn"><a name="setSwapInterval" />QGLFormat.setSwapInterval (<i>self</i>, int <i>interval</i>)</h3><p>Set the preferred swap interval. This can be used to sync the GL
681
drawing into a system window to the vertical refresh of the screen.
682
Setting an <i>interval</i> value of 0 will turn the vertical
683
refresh syncing off, any value higher than 0 will turn the vertical
685
<p>Under Windows and under X11, where the
686
<tt>WGL_EXT_swap_control</tt> and <tt>GLX_SGI_video_sync</tt>
687
extensions are used, the <i>interval</i> parameter can be used to
688
set the minimum number of video frames that are displayed before a
689
buffer swap will occur. In effect, setting the <i>interval</i> to
690
10, means there will be 10 vertical retraces between every buffer
692
<p>Under Windows the <tt>WGL_EXT_swap_control</tt> extension has to
693
be present, and under X11 the <tt>GLX_SGI_video_sync</tt> extension
694
has to be present.</p>
695
<p>This function was introduced in Qt 4.2.</p>
696
<p><b>See also</b> <a href="qglformat.html#swapInterval">swapInterval</a>().</p>
699
<h3 class="fn"><a name="setVersion" />QGLFormat.setVersion (<i>self</i>, int <i>major</i>, int <i>minor</i>)</h3><p>Set the OpenGL version to the <i>major</i> and <i>minor</i>
700
numbers. If a context compatible with the requested OpenGL version
701
cannot be created, a context compatible with version 1.x is created
703
<p>This function was introduced in Qt 4.7.</p>
704
<p><b>See also</b> <a href="qglformat.html#majorVersion">majorVersion</a>() and <a href="qglformat.html#minorVersion">minorVersion</a>().</p>
707
<h3 class="fn"><a name="stencil" />bool QGLFormat.stencil (<i>self</i>)</h3><p>Returns true if the stencil buffer is enabled; otherwise returns
708
false. The stencil buffer is enabled by default.</p>
709
<p><b>See also</b> <a href="qglformat.html#setStencil">setStencil</a>() and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
712
<h3 class="fn"><a name="stencilBufferSize" />int QGLFormat.stencilBufferSize (<i>self</i>)</h3><p>Returns the stencil buffer size.</p>
713
<p><b>See also</b> <a href="qglformat.html#stencil">stencil</a>(),
714
<a href="qglformat.html#setStencil">setStencil</a>(), and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
717
<h3 class="fn"><a name="stereo" />bool QGLFormat.stereo (<i>self</i>)</h3><p>Returns true if stereo buffering is enabled; otherwise returns
718
false. Stereo buffering is disabled by default.</p>
719
<p><b>See also</b> <a href="qglformat.html#setStereo">setStereo</a>().</p>
722
<h3 class="fn"><a name="swapInterval" />int QGLFormat.swapInterval (<i>self</i>)</h3><p>Returns the currently set swap interval. -1 is returned if
723
setting the swap interval isn't supported in the system GL
725
<p>This function was introduced in Qt 4.2.</p>
726
<p><b>See also</b> <a href="qglformat.html#setSwapInterval">setSwapInterval</a>().</p>
729
<h3 class="fn"><a name="testOption" />bool QGLFormat.testOption (<i>self</i>, <a href="qgl-formatoptions.html">QGL.FormatOptions</a> <i>opt</i>)</h3><p>Returns true if format option <i>opt</i> is set; otherwise
731
<p><b>See also</b> <a href="qglformat.html#setOption">setOption</a>().</p>
734
<h3 class="fn"><a name="__eq__" />bool QGLFormat.__eq__ (<i>self</i>, <a href="qglformat.html">QGLFormat</a>)</h3><h3 class="fn"><a name="__ne__" />bool QGLFormat.__ne__ (<i>self</i>, <a href="qglformat.html">QGLFormat</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'