[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/opengl/qgl.cpp:95 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QGLFormat Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QGLFormat Class Reference<br><small>[<a href="opengl.html">OpenGL module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QGLFormat class specifies the display format of an OpenGL
|
---|
| 35 | rendering context.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p><tt>#include <<a href="qgl-h.html">qgl.h</a>></tt>
|
---|
| 38 | <p>Inherits <a href="qgl.html">QGL</a>.
|
---|
| 39 | <p><a href="qglformat-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn><a href="#QGLFormat"><b>QGLFormat</b></a> ()</li>
|
---|
| 43 | <li class=fn><a href="#QGLFormat-2"><b>QGLFormat</b></a> ( int options, int plane = 0 )</li>
|
---|
| 44 | <li class=fn>bool <a href="#doubleBuffer"><b>doubleBuffer</b></a> () const</li>
|
---|
| 45 | <li class=fn>void <a href="#setDoubleBuffer"><b>setDoubleBuffer</b></a> ( bool enable )</li>
|
---|
| 46 | <li class=fn>bool <a href="#depth"><b>depth</b></a> () const</li>
|
---|
| 47 | <li class=fn>void <a href="#setDepth"><b>setDepth</b></a> ( bool enable )</li>
|
---|
| 48 | <li class=fn>bool <a href="#rgba"><b>rgba</b></a> () const</li>
|
---|
| 49 | <li class=fn>void <a href="#setRgba"><b>setRgba</b></a> ( bool enable )</li>
|
---|
| 50 | <li class=fn>bool <a href="#alpha"><b>alpha</b></a> () const</li>
|
---|
| 51 | <li class=fn>void <a href="#setAlpha"><b>setAlpha</b></a> ( bool enable )</li>
|
---|
| 52 | <li class=fn>bool <a href="#accum"><b>accum</b></a> () const</li>
|
---|
| 53 | <li class=fn>void <a href="#setAccum"><b>setAccum</b></a> ( bool enable )</li>
|
---|
| 54 | <li class=fn>bool <a href="#stencil"><b>stencil</b></a> () const</li>
|
---|
| 55 | <li class=fn>void <a href="#setStencil"><b>setStencil</b></a> ( bool enable )</li>
|
---|
| 56 | <li class=fn>bool <a href="#stereo"><b>stereo</b></a> () const</li>
|
---|
| 57 | <li class=fn>void <a href="#setStereo"><b>setStereo</b></a> ( bool enable )</li>
|
---|
| 58 | <li class=fn>bool <a href="#directRendering"><b>directRendering</b></a> () const</li>
|
---|
| 59 | <li class=fn>void <a href="#setDirectRendering"><b>setDirectRendering</b></a> ( bool enable )</li>
|
---|
| 60 | <li class=fn>bool <a href="#hasOverlay"><b>hasOverlay</b></a> () const</li>
|
---|
| 61 | <li class=fn>void <a href="#setOverlay"><b>setOverlay</b></a> ( bool enable )</li>
|
---|
| 62 | <li class=fn>int <a href="#plane"><b>plane</b></a> () const</li>
|
---|
| 63 | <li class=fn>void <a href="#setPlane"><b>setPlane</b></a> ( int plane )</li>
|
---|
| 64 | <li class=fn>void <a href="#setOption"><b>setOption</b></a> ( FormatOption opt )</li>
|
---|
| 65 | <li class=fn>bool <a href="#testOption"><b>testOption</b></a> ( FormatOption opt ) const</li>
|
---|
| 66 | </ul>
|
---|
| 67 | <h2>Static Public Members</h2>
|
---|
| 68 | <ul>
|
---|
| 69 | <li class=fn>QGLFormat <a href="#defaultFormat"><b>defaultFormat</b></a> ()</li>
|
---|
| 70 | <li class=fn>void <a href="#setDefaultFormat"><b>setDefaultFormat</b></a> ( const QGLFormat & f )</li>
|
---|
| 71 | <li class=fn>QGLFormat <a href="#defaultOverlayFormat"><b>defaultOverlayFormat</b></a> ()</li>
|
---|
| 72 | <li class=fn>void <a href="#setDefaultOverlayFormat"><b>setDefaultOverlayFormat</b></a> ( const QGLFormat & f )</li>
|
---|
| 73 | <li class=fn>bool <a href="#hasOpenGL"><b>hasOpenGL</b></a> ()</li>
|
---|
| 74 | <li class=fn>bool <a href="#hasOpenGLOverlays"><b>hasOpenGLOverlays</b></a> ()</li>
|
---|
| 75 | </ul>
|
---|
| 76 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | The QGLFormat class specifies the display format of an OpenGL
|
---|
| 80 | rendering context.
|
---|
| 81 |
|
---|
| 82 | <p>
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | <p> A display format has several characteristics:
|
---|
| 86 | <ul>
|
---|
| 87 | <li> <a href="#setDoubleBuffer">Double or single buffering.</a>
|
---|
| 88 | <li> <a href="#setDepth">Depth buffer.</a>
|
---|
| 89 | <li> <a href="#setRgba">RGBA or color index mode.</a>
|
---|
| 90 | <li> <a href="#setAlpha">Alpha channel.</a>
|
---|
| 91 | <li> <a href="#setAccum">Accumulation buffer.</a>
|
---|
| 92 | <li> <a href="#setStencil">Stencil buffer.</a>
|
---|
| 93 | <li> <a href="#setStereo">Stereo buffers.</a>
|
---|
| 94 | <li> <a href="#setDirectRendering">Direct rendering.</a>
|
---|
| 95 | <li> <a href="#setOverlay">Presence of an overlay.</a>
|
---|
| 96 | <li> <a href="#setPlane">The plane of an overlay format.</a>
|
---|
| 97 | </ul>
|
---|
| 98 | <p> You create and tell a QGLFormat object what rendering options you
|
---|
| 99 | want from an OpenGL<sup>*</sup> rendering context.
|
---|
| 100 | <p> OpenGL drivers or accelerated hardware may or may not support
|
---|
| 101 | advanced features such as alpha channel or stereographic viewing.
|
---|
| 102 | If you request some features that the driver/hardware does not
|
---|
| 103 | provide when you create a <a href="qglwidget.html">QGLWidget</a>, you will get a rendering
|
---|
| 104 | context with the nearest subset of features.
|
---|
| 105 | <p> There are different ways to define the display characteristics of
|
---|
| 106 | a rendering context. One is to create a QGLFormat and make it the
|
---|
| 107 | default for the entire application:
|
---|
| 108 | <pre>
|
---|
| 109 | QGLFormat f;
|
---|
| 110 | f.<a href="#setAlpha">setAlpha</a>( TRUE );
|
---|
| 111 | f.<a href="#setStereo">setStereo</a>( TRUE );
|
---|
| 112 | QGLFormat::<a href="#setDefaultFormat">setDefaultFormat</a>( f );
|
---|
| 113 | </pre>
|
---|
| 114 |
|
---|
| 115 | <p> Or you can specify the desired format when creating an object of
|
---|
| 116 | your QGLWidget subclass:
|
---|
| 117 | <pre>
|
---|
| 118 | QGLFormat f;
|
---|
| 119 | f.<a href="#setDoubleBuffer">setDoubleBuffer</a>( FALSE ); // single buffer
|
---|
| 120 | f.<a href="#setDirectRendering">setDirectRendering</a>( FALSE ); // software rendering
|
---|
| 121 | MyGLWidget* myWidget = new MyGLWidget( f, ... );
|
---|
| 122 | </pre>
|
---|
| 123 |
|
---|
| 124 | <p> After the widget has been created, you can find out which of the
|
---|
| 125 | requested features the system was able to provide:
|
---|
| 126 | <pre>
|
---|
| 127 | QGLFormat f;
|
---|
| 128 | f.<a href="#setOverlay">setOverlay</a>( TRUE );
|
---|
| 129 | f.<a href="#setStereo">setStereo</a>( TRUE );
|
---|
| 130 | MyGLWidget* myWidget = new MyGLWidget( f, ... );
|
---|
| 131 | if ( !w->format().stereo() ) {
|
---|
| 132 | // ok, goggles off
|
---|
| 133 | if ( !w->format().hasOverlay() ) {
|
---|
| 134 | <a href="qapplication.html#qFatal">qFatal</a>( "Cool hardware required" );
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 | </pre>
|
---|
| 138 |
|
---|
| 139 | <p> <sup>*</sup> OpenGL is a trademark of Silicon Graphics, Inc. in the
|
---|
| 140 | United States and other countries.
|
---|
| 141 | <p> <p>See also <a href="qglcontext.html">QGLContext</a>, <a href="qglwidget.html">QGLWidget</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
|
---|
| 142 |
|
---|
| 143 | <hr><h2>Member Function Documentation</h2>
|
---|
| 144 | <h3 class=fn><a name="QGLFormat"></a>QGLFormat::QGLFormat ()
|
---|
| 145 | </h3>
|
---|
| 146 | Constructs a QGLFormat object with the factory default settings:
|
---|
| 147 | <ul>
|
---|
| 148 | <li> <a href="#setDoubleBuffer">Double buffer:</a> Enabled.
|
---|
| 149 | <li> <a href="#setDepth">Depth buffer:</a> Enabled.
|
---|
| 150 | <li> <a href="#setRgba">RGBA:</a> Enabled (i.e., color index disabled).
|
---|
| 151 | <li> <a href="#setAlpha">Alpha channel:</a> Disabled.
|
---|
| 152 | <li> <a href="#setAccum">Accumulator buffer:</a> Disabled.
|
---|
| 153 | <li> <a href="#setStencil">Stencil buffer:</a> Disabled.
|
---|
| 154 | <li> <a href="#setStereo">Stereo:</a> Disabled.
|
---|
| 155 | <li> <a href="#setDirectRendering">Direct rendering:</a> Enabled.
|
---|
| 156 | <li> <a href="#setOverlay">Overlay:</a> Disabled.
|
---|
| 157 | <li> <a href="#setPlane">Plane:</a> 0 (i.e., normal plane).
|
---|
| 158 | </ul>
|
---|
| 159 |
|
---|
| 160 | <h3 class=fn><a name="QGLFormat-2"></a>QGLFormat::QGLFormat ( int options, int plane = 0 )
|
---|
| 161 | </h3>
|
---|
| 162 | Creates a QGLFormat object that is a copy of the current <a href="#defaultFormat">application default format</a>.
|
---|
| 163 | <p> If <em>options</em> is not 0, this copy is modified by these format
|
---|
| 164 | options. The <em>options</em> parameter should be <a href="qgl.html#FormatOption-enum">FormatOption</a> values
|
---|
| 165 | OR'ed together.
|
---|
| 166 | <p> This constructor makes it easy to specify a certain desired format
|
---|
| 167 | in classes derived from <a href="qglwidget.html">QGLWidget</a>, for example:
|
---|
| 168 | <pre>
|
---|
| 169 | // The rendering in MyGLWidget depends on using
|
---|
| 170 | // stencil buffer and alpha channel
|
---|
| 171 | MyGLWidget::MyGLWidget( <a href="qwidget.html">QWidget</a>* parent, const char* name )
|
---|
| 172 | : <a href="qglwidget.html">QGLWidget</a>( <a href="#QGLFormat">QGLFormat</a>( StencilBuffer | AlphaChannel ), parent, name )
|
---|
| 173 | {
|
---|
| 174 | if ( !format().stencil() )
|
---|
| 175 | <a href="qapplication.html#qWarning">qWarning</a>( "Could not get stencil buffer; results will be suboptimal" );
|
---|
| 176 | if ( !format().alphaChannel() )
|
---|
| 177 | <a href="qapplication.html#qWarning">qWarning</a>( "Could not get alpha channel; results will be suboptimal" );
|
---|
| 178 | ...
|
---|
| 179 | }
|
---|
| 180 | </pre>
|
---|
| 181 |
|
---|
| 182 | <p> Note that there are <a href="qgl.html#FormatOption-enum">FormatOption</a> values to turn format settings
|
---|
| 183 | both on and off, e.g. <a href="qgl.html#FormatOption-enum">DepthBuffer</a> and <a href="qgl.html#FormatOption-enum">NoDepthBuffer</a>,
|
---|
| 184 | <a href="qgl.html#FormatOption-enum">DirectRendering</a> and <a href="qgl.html#FormatOption-enum">IndirectRendering</a>, etc.
|
---|
| 185 | <p> The <em>plane</em> parameter defaults to 0 and is the plane which this
|
---|
| 186 | format should be associated with. Not all OpenGL implmentations
|
---|
| 187 | supports overlay/underlay rendering planes.
|
---|
| 188 | <p> <p>See also <a href="#defaultFormat">defaultFormat</a>() and <a href="#setOption">setOption</a>().
|
---|
| 189 |
|
---|
| 190 | <h3 class=fn>bool <a name="accum"></a>QGLFormat::accum () const
|
---|
| 191 | </h3>
|
---|
| 192 |
|
---|
| 193 | <p> Returns TRUE if the accumulation buffer is enabled; otherwise
|
---|
| 194 | returns FALSE. The accumulation buffer is disabled by default.
|
---|
| 195 | <p> <p>See also <a href="#setAccum">setAccum</a>().
|
---|
| 196 |
|
---|
| 197 | <h3 class=fn>bool <a name="alpha"></a>QGLFormat::alpha () const
|
---|
| 198 | </h3>
|
---|
| 199 |
|
---|
| 200 | <p> Returns TRUE if the alpha channel of the framebuffer is enabled;
|
---|
| 201 | otherwise returns FALSE. The alpha channel is disabled by default.
|
---|
| 202 | <p> <p>See also <a href="#setAlpha">setAlpha</a>().
|
---|
| 203 |
|
---|
| 204 | <h3 class=fn><a href="qglformat.html">QGLFormat</a> <a name="defaultFormat"></a>QGLFormat::defaultFormat ()<tt> [static]</tt>
|
---|
| 205 | </h3>
|
---|
| 206 | Returns the default QGLFormat for the application. All QGLWidgets
|
---|
| 207 | that are created use this format unless another format is
|
---|
| 208 | specified, e.g. when they are constructed.
|
---|
| 209 | <p> If no special default format has been set using
|
---|
| 210 | <a href="#setDefaultFormat">setDefaultFormat</a>(), the default format is the same as that created
|
---|
| 211 | with QGLFormat().
|
---|
| 212 | <p> <p>See also <a href="#setDefaultFormat">setDefaultFormat</a>().
|
---|
| 213 |
|
---|
| 214 | <h3 class=fn><a href="qglformat.html">QGLFormat</a> <a name="defaultOverlayFormat"></a>QGLFormat::defaultOverlayFormat ()<tt> [static]</tt>
|
---|
| 215 | </h3>
|
---|
| 216 | Returns the default QGLFormat for overlay contexts.
|
---|
| 217 | <p> The factory default overlay format is:
|
---|
| 218 | <ul>
|
---|
| 219 | <li> <a href="#setDoubleBuffer">Double buffer:</a> Disabled.
|
---|
| 220 | <li> <a href="#setDepth">Depth buffer:</a> Disabled.
|
---|
| 221 | <li> <a href="#setRgba">RGBA:</a> Disabled (i.e., color index enabled).
|
---|
| 222 | <li> <a href="#setAlpha">Alpha channel:</a> Disabled.
|
---|
| 223 | <li> <a href="#setAccum">Accumulator buffer:</a> Disabled.
|
---|
| 224 | <li> <a href="#setStencil">Stencil buffer:</a> Disabled.
|
---|
| 225 | <li> <a href="#setStereo">Stereo:</a> Disabled.
|
---|
| 226 | <li> <a href="#setDirectRendering">Direct rendering:</a> Enabled.
|
---|
| 227 | <li> <a href="#setOverlay">Overlay:</a> Disabled.
|
---|
| 228 | <li> <a href="#setPlane">Plane:</a> 1 (i.e., first overlay plane).
|
---|
| 229 | </ul>
|
---|
| 230 | <p> <p>See also <a href="#setDefaultFormat">setDefaultFormat</a>().
|
---|
| 231 |
|
---|
| 232 | <h3 class=fn>bool <a name="depth"></a>QGLFormat::depth () const
|
---|
| 233 | </h3>
|
---|
| 234 |
|
---|
| 235 | <p> Returns TRUE if the depth buffer is enabled; otherwise returns
|
---|
| 236 | FALSE. The depth buffer is enabled by default.
|
---|
| 237 | <p> <p>See also <a href="#setDepth">setDepth</a>().
|
---|
| 238 |
|
---|
| 239 | <h3 class=fn>bool <a name="directRendering"></a>QGLFormat::directRendering () const
|
---|
| 240 | </h3>
|
---|
| 241 |
|
---|
| 242 | <p> Returns TRUE if direct rendering is enabled; otherwise returns
|
---|
| 243 | FALSE.
|
---|
| 244 | <p> Direct rendering is enabled by default.
|
---|
| 245 | <p> <p>See also <a href="#setDirectRendering">setDirectRendering</a>().
|
---|
| 246 |
|
---|
| 247 | <h3 class=fn>bool <a name="doubleBuffer"></a>QGLFormat::doubleBuffer () const
|
---|
| 248 | </h3>
|
---|
| 249 |
|
---|
| 250 | <p> Returns TRUE if double buffering is enabled; otherwise returns
|
---|
| 251 | FALSE. Double buffering is enabled by default.
|
---|
| 252 | <p> <p>See also <a href="#setDoubleBuffer">setDoubleBuffer</a>().
|
---|
| 253 |
|
---|
| 254 | <h3 class=fn>bool <a name="hasOpenGL"></a>QGLFormat::hasOpenGL ()<tt> [static]</tt>
|
---|
| 255 | </h3>
|
---|
| 256 |
|
---|
| 257 | <p> Returns TRUE if the window system has any OpenGL support;
|
---|
| 258 | otherwise returns FALSE.
|
---|
| 259 | <p> <b>Warning:</b> This function must not be called until the <a href="qapplication.html">QApplication</a>
|
---|
| 260 | object has been created.
|
---|
| 261 |
|
---|
| 262 | <h3 class=fn>bool <a name="hasOpenGLOverlays"></a>QGLFormat::hasOpenGLOverlays ()<tt> [static]</tt>
|
---|
| 263 | </h3>
|
---|
| 264 |
|
---|
| 265 | <p> Returns TRUE if the window system supports OpenGL overlays;
|
---|
| 266 | otherwise returns FALSE.
|
---|
| 267 | <p> <b>Warning:</b> This function must not be called until the <a href="qapplication.html">QApplication</a>
|
---|
| 268 | object has been created.
|
---|
| 269 |
|
---|
| 270 | <h3 class=fn>bool <a name="hasOverlay"></a>QGLFormat::hasOverlay () const
|
---|
| 271 | </h3>
|
---|
| 272 |
|
---|
| 273 | <p> Returns TRUE if overlay plane is enabled; otherwise returns FALSE.
|
---|
| 274 | <p> Overlay is disabled by default.
|
---|
| 275 | <p> <p>See also <a href="#setOverlay">setOverlay</a>().
|
---|
| 276 |
|
---|
| 277 | <h3 class=fn>int <a name="plane"></a>QGLFormat::plane () const
|
---|
| 278 | </h3>
|
---|
| 279 | Returns the plane of this format. The default for normal formats
|
---|
| 280 | is 0, which means the normal plane. The default for overlay
|
---|
| 281 | formats is 1, which is the first overlay plane.
|
---|
| 282 | <p> <p>See also <a href="#setPlane">setPlane</a>().
|
---|
| 283 |
|
---|
| 284 | <h3 class=fn>bool <a name="rgba"></a>QGLFormat::rgba () const
|
---|
| 285 | </h3>
|
---|
| 286 |
|
---|
| 287 | <p> Returns TRUE if RGBA color mode is set. Returns FALSE if color
|
---|
| 288 | index mode is set. The default color mode is RGBA.
|
---|
| 289 | <p> <p>See also <a href="#setRgba">setRgba</a>().
|
---|
| 290 |
|
---|
| 291 | <h3 class=fn>void <a name="setAccum"></a>QGLFormat::setAccum ( bool enable )
|
---|
| 292 | </h3>
|
---|
| 293 | If <em>enable</em> is TRUE enables the accumulation buffer; otherwise
|
---|
| 294 | disables the accumulation buffer.
|
---|
| 295 | <p> The accumulation buffer is disabled by default.
|
---|
| 296 | <p> The accumulation buffer is used to create blur effects and
|
---|
| 297 | multiple exposures.
|
---|
| 298 | <p> <p>See also <a href="#accum">accum</a>().
|
---|
| 299 |
|
---|
| 300 | <h3 class=fn>void <a name="setAlpha"></a>QGLFormat::setAlpha ( bool enable )
|
---|
| 301 | </h3>
|
---|
| 302 | If <em>enable</em> is TRUE enables the alpha channel; otherwise disables
|
---|
| 303 | the alpha channel.
|
---|
| 304 | <p> The alpha buffer is disabled by default.
|
---|
| 305 | <p> The alpha channel is typically used for implementing transparency
|
---|
| 306 | or translucency. The A in RGBA specifies the transparency of a
|
---|
| 307 | pixel.
|
---|
| 308 | <p> <p>See also <a href="#alpha">alpha</a>().
|
---|
| 309 |
|
---|
| 310 | <h3 class=fn>void <a name="setDefaultFormat"></a>QGLFormat::setDefaultFormat ( const <a href="qglformat.html">QGLFormat</a> & f )<tt> [static]</tt>
|
---|
| 311 | </h3>
|
---|
| 312 | Sets a new default QGLFormat for the application to <em>f</em>. For
|
---|
| 313 | example, to set single buffering as the default instead of double
|
---|
| 314 | buffering, your main() might contain code like this:
|
---|
| 315 | <pre>
|
---|
| 316 | <a href="qapplication.html">QApplication</a> a(argc, argv);
|
---|
| 317 | QGLFormat f;
|
---|
| 318 | f.<a href="#setDoubleBuffer">setDoubleBuffer</a>( FALSE );
|
---|
| 319 | QGLFormat::<a href="#setDefaultFormat">setDefaultFormat</a>( f );
|
---|
| 320 | </pre>
|
---|
| 321 |
|
---|
| 322 | <p> <p>See also <a href="#defaultFormat">defaultFormat</a>().
|
---|
| 323 |
|
---|
| 324 | <h3 class=fn>void <a name="setDefaultOverlayFormat"></a>QGLFormat::setDefaultOverlayFormat ( const <a href="qglformat.html">QGLFormat</a> & f )<tt> [static]</tt>
|
---|
| 325 | </h3>
|
---|
| 326 | Sets a new default QGLFormat for overlay contexts to <em>f</em>. This
|
---|
| 327 | format is used whenever a <a href="qglwidget.html">QGLWidget</a> is created with a format that
|
---|
| 328 | <a href="#hasOverlay">hasOverlay</a>() enabled.
|
---|
| 329 | <p> For example, to get a double buffered overlay context (if
|
---|
| 330 | available), use code like this:
|
---|
| 331 | <p> <pre>
|
---|
| 332 | QGLFormat f = QGLFormat::<a href="#defaultOverlayFormat">defaultOverlayFormat</a>();
|
---|
| 333 | f.<a href="#setDoubleBuffer">setDoubleBuffer</a>( TRUE );
|
---|
| 334 | QGLFormat::<a href="#setDefaultOverlayFormat">setDefaultOverlayFormat</a>( f );
|
---|
| 335 | </pre>
|
---|
| 336 |
|
---|
| 337 | <p> As usual, you can find out after widget creation whether the
|
---|
| 338 | underlying OpenGL system was able to provide the requested
|
---|
| 339 | specification:
|
---|
| 340 | <p> <pre>
|
---|
| 341 | // ...continued from above
|
---|
| 342 | MyGLWidget* myWidget = new MyGLWidget( <a href="#QGLFormat">QGLFormat</a>( QGL::<a href="qgl.html#FormatOption-enum">HasOverlay</a> ), ... );
|
---|
| 343 | if ( myWidget->format().hasOverlay() ) {
|
---|
| 344 | // Yes, we got an overlay, let's check _its_ format:
|
---|
| 345 | <a href="qglcontext.html">QGLContext</a>* olContext = myWidget->overlayContext();
|
---|
| 346 | if ( olContext-><a href="qglcontext.html#format">format</a>().doubleBuffer() )
|
---|
| 347 | ; // yes, we got a double buffered overlay
|
---|
| 348 | else
|
---|
| 349 | ; // no, only single buffered overlays are available
|
---|
| 350 | }
|
---|
| 351 | </pre>
|
---|
| 352 |
|
---|
| 353 | <p> <p>See also <a href="#defaultOverlayFormat">defaultOverlayFormat</a>().
|
---|
| 354 |
|
---|
| 355 | <h3 class=fn>void <a name="setDepth"></a>QGLFormat::setDepth ( bool enable )
|
---|
| 356 | </h3>
|
---|
| 357 | If <em>enable</em> is TRUE enables the depth buffer; otherwise disables
|
---|
| 358 | the depth buffer.
|
---|
| 359 | <p> The depth buffer is enabled by default.
|
---|
| 360 | <p> The purpose of a depth buffer (or Z-buffering) is to remove hidden
|
---|
| 361 | surfaces. Pixels are assigned Z values based on the distance to
|
---|
| 362 | the viewer. A pixel with a high Z value is closer to the viewer
|
---|
| 363 | than a pixel with a low Z value. This information is used to
|
---|
| 364 | decide whether to draw a pixel or not.
|
---|
| 365 | <p> <p>See also <a href="#depth">depth</a>().
|
---|
| 366 |
|
---|
| 367 | <h3 class=fn>void <a name="setDirectRendering"></a>QGLFormat::setDirectRendering ( bool enable )
|
---|
| 368 | </h3>
|
---|
| 369 | If <em>enable</em> is TRUE enables direct rendering; otherwise disables
|
---|
| 370 | direct rendering.
|
---|
| 371 | <p> Direct rendering is enabled by default.
|
---|
| 372 | <p> Enabling this option will make OpenGL bypass the underlying window
|
---|
| 373 | system and render directly from hardware to the screen, if this is
|
---|
| 374 | supported by the system.
|
---|
| 375 | <p> <p>See also <a href="#directRendering">directRendering</a>().
|
---|
| 376 |
|
---|
| 377 | <h3 class=fn>void <a name="setDoubleBuffer"></a>QGLFormat::setDoubleBuffer ( bool enable )
|
---|
| 378 | </h3>
|
---|
| 379 | If <em>enable</em> is TRUE sets double buffering; otherwise sets single
|
---|
| 380 | buffering.
|
---|
| 381 | <p> Double buffering is enabled by default.
|
---|
| 382 | <p> Double buffering is a technique where graphics are rendered on an
|
---|
| 383 | off-screen buffer and not directly to the screen. When the drawing
|
---|
| 384 | has been completed, the program calls a swapBuffers() function to
|
---|
| 385 | exchange the screen contents with the buffer. The result is
|
---|
| 386 | flicker-free drawing and often better performance.
|
---|
| 387 | <p> <p>See also <a href="#doubleBuffer">doubleBuffer</a>(), <a href="qglcontext.html#swapBuffers">QGLContext::swapBuffers</a>(), and <a href="qglwidget.html#swapBuffers">QGLWidget::swapBuffers</a>().
|
---|
| 388 |
|
---|
| 389 | <h3 class=fn>void <a name="setOption"></a>QGLFormat::setOption ( <a href="qgl.html#FormatOption-enum">FormatOption</a> opt )
|
---|
| 390 | </h3>
|
---|
| 391 | Sets the format option to <em>opt</em>.
|
---|
| 392 | <p> <p>See also <a href="#testOption">testOption</a>().
|
---|
| 393 |
|
---|
| 394 | <h3 class=fn>void <a name="setOverlay"></a>QGLFormat::setOverlay ( bool enable )
|
---|
| 395 | </h3>
|
---|
| 396 | If <em>enable</em> is TRUE enables an overlay plane; otherwise disables
|
---|
| 397 | the overlay plane.
|
---|
| 398 | <p> Enabling the overlay plane will cause <a href="qglwidget.html">QGLWidget</a> to create an
|
---|
| 399 | additional context in an overlay plane. See the QGLWidget
|
---|
| 400 | documentation for further information.
|
---|
| 401 | <p> <p>See also <a href="#hasOverlay">hasOverlay</a>().
|
---|
| 402 |
|
---|
| 403 | <h3 class=fn>void <a name="setPlane"></a>QGLFormat::setPlane ( int plane )
|
---|
| 404 | </h3>
|
---|
| 405 | Sets the requested plane to <em>plane</em>. 0 is the normal plane, 1 is
|
---|
| 406 | the first overlay plane, 2 is the second overlay plane, etc.; -1,
|
---|
| 407 | -2, etc. are underlay planes.
|
---|
| 408 | <p> Note that in contrast to other format specifications, the plane
|
---|
| 409 | specifications will be matched exactly. This means that if you
|
---|
| 410 | specify a plane that the underlying OpenGL system cannot provide,
|
---|
| 411 | an <a href="qglwidget.html#isValid">invalid</a> <a href="qglwidget.html">QGLWidget</a> will be
|
---|
| 412 | created.
|
---|
| 413 | <p> <p>See also <a href="#plane">plane</a>().
|
---|
| 414 |
|
---|
| 415 | <h3 class=fn>void <a name="setRgba"></a>QGLFormat::setRgba ( bool enable )
|
---|
| 416 | </h3>
|
---|
| 417 | If <em>enable</em> is TRUE sets RGBA mode. If <em>enable</em> is FALSE sets
|
---|
| 418 | color index mode.
|
---|
| 419 | <p> The default color mode is RGBA.
|
---|
| 420 | <p> RGBA is the preferred mode for most OpenGL applications. In RGBA
|
---|
| 421 | color mode you specify colors as red + green + blue + alpha
|
---|
| 422 | quadruplets.
|
---|
| 423 | <p> In color index mode you specify an index into a color lookup
|
---|
| 424 | table.
|
---|
| 425 | <p> <p>See also <a href="#rgba">rgba</a>().
|
---|
| 426 |
|
---|
| 427 | <h3 class=fn>void <a name="setStencil"></a>QGLFormat::setStencil ( bool enable )
|
---|
| 428 | </h3>
|
---|
| 429 | If <em>enable</em> is TRUE enables the stencil buffer; otherwise
|
---|
| 430 | disables the stencil buffer.
|
---|
| 431 | <p> The stencil buffer is disabled by default.
|
---|
| 432 | <p> The stencil buffer masks certain parts of the drawing area so that
|
---|
| 433 | masked parts are not drawn on.
|
---|
| 434 | <p> <p>See also <a href="#stencil">stencil</a>().
|
---|
| 435 |
|
---|
| 436 | <h3 class=fn>void <a name="setStereo"></a>QGLFormat::setStereo ( bool enable )
|
---|
| 437 | </h3>
|
---|
| 438 | If <em>enable</em> is TRUE enables stereo buffering; otherwise disables
|
---|
| 439 | stereo buffering.
|
---|
| 440 | <p> Stereo buffering is disabled by default.
|
---|
| 441 | <p> Stereo buffering provides extra color buffers to generate left-eye
|
---|
| 442 | and right-eye images.
|
---|
| 443 | <p> <p>See also <a href="#stereo">stereo</a>().
|
---|
| 444 |
|
---|
| 445 | <h3 class=fn>bool <a name="stencil"></a>QGLFormat::stencil () const
|
---|
| 446 | </h3>
|
---|
| 447 |
|
---|
| 448 | <p> Returns TRUE if the stencil buffer is enabled; otherwise returns
|
---|
| 449 | FALSE. The stencil buffer is disabled by default.
|
---|
| 450 | <p> <p>See also <a href="#setStencil">setStencil</a>().
|
---|
| 451 |
|
---|
| 452 | <h3 class=fn>bool <a name="stereo"></a>QGLFormat::stereo () const
|
---|
| 453 | </h3>
|
---|
| 454 |
|
---|
| 455 | <p> Returns TRUE if stereo buffering is enabled; otherwise returns
|
---|
| 456 | FALSE. Stereo buffering is disabled by default.
|
---|
| 457 | <p> <p>See also <a href="#setStereo">setStereo</a>().
|
---|
| 458 |
|
---|
| 459 | <h3 class=fn>bool <a name="testOption"></a>QGLFormat::testOption ( <a href="qgl.html#FormatOption-enum">FormatOption</a> opt ) const
|
---|
| 460 | </h3>
|
---|
| 461 | Returns TRUE if format option <em>opt</em> is set; otherwise returns FALSE.
|
---|
| 462 | <p> <p>See also <a href="#setOption">setOption</a>().
|
---|
| 463 |
|
---|
| 464 | <!-- eof -->
|
---|
| 465 | <hr><p>
|
---|
| 466 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 467 | Copyright © 1995-2007
|
---|
| 468 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 469 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 470 | <td>Copyright © 2007
|
---|
| 471 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 472 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 473 | </table></div></address></body>
|
---|
| 474 | </html>
|
---|