⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qglformat.3qt

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 3QT
字号:
.TH QGLFormat 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQGLFormat \- The display format of an OpenGL rendering context<h1 align=center>QGLFormat Class Reference.br<small>[ OpenGL module ]</small></h1>.br.PP\fC#include <qgl.h>\fR.PPInherits QGL..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQGLFormat\fR () ".br.ti -1c.BI "\fBQGLFormat\fR ( int " "options" ", int " "plane" " = 0 ) ".br.ti -1c.BI "bool \fBdoubleBuffer\fR () const".br.ti -1c.BI "void \fBsetDoubleBuffer\fR ( bool enable ) ".br.ti -1c.BI "bool \fBdepth\fR () const".br.ti -1c.BI "void \fBsetDepth\fR ( bool enable ) ".br.ti -1c.BI "bool \fBrgba\fR () const".br.ti -1c.BI "void \fBsetRgba\fR ( bool enable ) ".br.ti -1c.BI "bool \fBalpha\fR () const".br.ti -1c.BI "void \fBsetAlpha\fR ( bool enable ) ".br.ti -1c.BI "bool \fBaccum\fR () const".br.ti -1c.BI "void \fBsetAccum\fR ( bool enable ) ".br.ti -1c.BI "bool \fBstencil\fR () const".br.ti -1c.BI "void \fBsetStencil\fR ( bool enable ) ".br.ti -1c.BI "bool \fBstereo\fR () const".br.ti -1c.BI "void \fBsetStereo\fR ( bool enable ) ".br.ti -1c.BI "bool \fBdirectRendering\fR () const".br.ti -1c.BI "void \fBsetDirectRendering\fR ( bool enable ) ".br.ti -1c.BI "bool \fBhasOverlay\fR () const".br.ti -1c.BI "void \fBsetOverlay\fR ( bool enable ) ".br.ti -1c.BI "int \fBplane\fR () const".br.ti -1c.BI "void \fBsetPlane\fR ( int plane ) ".br.ti -1c.BI "void \fBsetOption\fR ( FormatOption opt ) ".br.ti -1c.BI "bool \fBtestOption\fR ( FormatOption opt ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QGLFormat \fBdefaultFormat\fR () ".br.ti -1c.BI "void \fBsetDefaultFormat\fR ( const QGLFormat & f ) ".br.ti -1c.BI "QGLFormat \fBdefaultOverlayFormat\fR () ".br.ti -1c.BI "void \fBsetDefaultOverlayFormat\fR ( const QGLFormat & f ) ".br.ti -1c.BI "bool \fBhasOpenGL\fR () ".br.ti -1c.BI "bool \fBhasOpenGLOverlays\fR () ".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "const char * \fBqGLVersion\fR ()".br.in -1c.SH DESCRIPTIONThe QGLFormat class specifies the display format of an OpenGL rendering context..PPA display format has several characteristics:.TPDouble or single buffering..TPDepth buffer..TPRGBA or color index mode..TPAlpha channel..TPAccumulation buffer..TPStencil buffer..TPStereo buffers..TPDirect rendering..TPPresence of an overlay..TPThe plane of an overlay format..PPYou create and tell a QGLFormat object what rendering options you want from an OpenGL rendering context..PPOpenGL drivers or accelerated hardware may or may not support advanced features like alpha channel or stereographic viewing. If you request some features the driver/hardware does not provide when you create a QGLWidget, you will get the a rendering context with the nearest subset of features..PPThere are different ways of defining the display characteristics of a rendering context. One is to create a QGLFormat and make it default for the entire application:.PP.nf.br    QGLFormat f;.br    f.setAlpha( TRUE );.br    f.setStereo( TRUE );.br    QGLFormat::setDefaultFormat( f );.fi.PPOr you can specify the desired format when creating an object of your QGLWidget subclass:.PP.nf.br    QGLFormat f;.br    f.setDoubleBuffer( FALSE );                 // I want single buffer.br    f.setDirectRendering( FALSE );              // I want software rendering.br    MyGLWidget* myWidget = new MyGLWidget( f, ... );.fi.PPAfter the widget has been created, you can test which of the requested features the system was able to provide:.PP.nf.br    QGLFormat f;.br    f.setOverlay( TRUE );.br    f.setStereo( TRUE );.br    MyGLWidget* myWidget = new MyGLWidget( f, ... );.br    if ( !w->format().stereo() ) {.br        // ok, goggles off.br        if ( !w->format().hasOverlay() ) {.br            qFatal( "Cool hardware wanted" );.br        }.br    }.fi.PPSee also QGLContext and QGLWidget..SH MEMBER FUNCTION DOCUMENTATION.SH "QGLFormat::QGLFormat ()"Constructs a QGLFormat object with the factory default settings:.TPDouble buffer: Enabled..TPDepth buffer: Enabled..TPRGBA: Enabled (i.e. color index disabled)..TPAlpha channel: Disabled..TPAccumulator buffer: Disabled..TPStencil buffer: Disabled..TPStereo: Disabled..TPDirect rendering: Enabled..TPOverlay: Disabled..TPPlane: 0 (i.e. normal plane)..SH "QGLFormat::QGLFormat ( int options, int plane = 0 )"Creates a QGLFormat object that is a copy of the current application default format..PPIf \fIoptions\fR is not 0, this copy will be modified by these format options. The \fIoptions\fR parameter must be FormatOption values OR'ed together..PPThis constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example:.PP.nf.br    // The rendering in MyGLWidget depends on using.br    // stencil buffer and alpha channel.br    MyGLWidget::MyGLWidget( QWidget* parent, const char* name ).br        : QGLWidget( QGLFormat( StencilBuffer | AlphaChannel ), parent, name ).br    {.br      if ( !format().stencil() ).br        qWarning( "Could not get stencil buffer; results will be suboptimal" );.br      if ( !format().alphaChannel() ).br        qWarning( "Could not get alpha channel; results will be suboptimal" );.br      ....br   }.fi.PPNote that there exists FormatOption values for both turning on and off all format settings, e.g. DepthBuffer and NoDepthBuffer, DirectRendering and IndirectRendering, etc..PPSee also defaultFormat() and setOption()..SH "bool QGLFormat::accum () const"Returns TRUE if the accumulation buffer is enabled, otherwise FALSE. The accumulation buffer is disabled by default..PPSee also setAccum()..SH "bool QGLFormat::alpha () const"Returns TRUE if the alpha channel of the framebuffer is enabled, otherwise FALSE. The alpha channel is disabled by default..PPSee also setAlpha()..SH "QGLFormat QGLFormat::defaultFormat () \fC[static]\fR"Returns the default QGLFormat for the application. All QGLWidgets that are created use this format unless anything else is specified..PPIf no special default format has been set using setDefaultFormat(), the default format is the same as that created with QGLFormat()..PPSee also setDefaultFormat()..SH "QGLFormat QGLFormat::defaultOverlayFormat () \fC[static]\fR"Returns the default QGLFormat for overlay contexts..PPThe factory default overlay format is:.TPDouble buffer: Disabled..TPDepth buffer: Disabled..TPRGBA: Disabled (i.e. color index enabled)..TPAlpha channel: Disabled..TPAccumulator buffer: Disabled..TPStencil buffer: Disabled..TPStereo: Disabled..TPDirect rendering: Enabled..TPOverlay: Disabled..TPPlane: 1 (i.e. first overlay plane)..PPSee also setDefaultFormat()..SH "bool QGLFormat::depth () const"Returns TRUE if the depth buffer is enabled, otherwise FALSE. The depth buffer is enabled by default..PPSee also setDepth()..SH "bool QGLFormat::directRendering () const"Returns TRUE if direct rendering is enabled, otherwise FALSE..PPDirect rendering is enabled by default..PPSee also setDirectRendering()..SH "bool QGLFormat::doubleBuffer () const"Returns TRUE if double buffering is enabled, otherwise FALSE. Double buffering is enabled by default..PPSee also setDoubleBuffer()..SH "bool QGLFormat::hasOpenGL () \fC[static]\fR"Returns TRUE if the window system has any OpenGL support, otherwise FALSE..PPNote: This function may not be called until the QApplication object has been created..SH "bool QGLFormat::hasOpenGLOverlays () \fC[static]\fR"Returns TRUE if the window system supports OpenGL overlays, otherwise FALSE..PPNote: This function may not be called until the QApplication object has been created..SH "bool QGLFormat::hasOverlay () const"Returns TRUE if overlay plane is enabled, otherwise FALSE..PPOverlay is disabled by default..PPSee also setOverlay()..SH "int QGLFormat::plane () const"Returns the plane of this format. Default for normal formats is 0, which means the normal plane; default for overlay formats is 1, which is the first overlay plane..PPSee also setPlane()..SH "bool QGLFormat::rgba () const"Returns TRUE if RGBA color mode is set, or FALSE if color index mode is set. The default color mode is RGBA..PPSee also setRgba()..SH "void QGLFormat::setAccum ( bool enable )"Enables the accumulation buffer if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPThe accumulation buffer is disabled by default..PPThe accumulation buffer is used for create blur effects and multiple exposures..PPSee also accum()..SH "void QGLFormat::setAlpha ( bool enable )"Enables the alpha channel of the framebuffer if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPThe alpha buffer is disabled by default..PPThe alpha channel is typically used for implementing transparency or translucency. The A in RGBA specifies the transparency of a pixel..PPSee also alpha()..SH "void QGLFormat::setDefaultFormat ( const QGLFormat & f ) \fC[static]\fR"Sets a new default QGLFormat for the application. For example, to set single buffering as default instead of double buffering, your main() can contain:.PP.nf.br    QApplication a(argc, argv);.br    QGLFormat f;.br    f.setDoubleBuffer( FALSE );.br    QGLFormat::setDefaultFormat( f );.fi.PPSee also defaultFormat()..SH "void QGLFormat::setDefaultOverlayFormat ( const QGLFormat & f ) \fC[static]\fR"Sets a new default QGLFormat for overlay contexts. This format is used whenever a QGLWidget is created with a format with hasOverlay() enabled..PPFor example, to get a double buffered overlay contexts (if available), the code can do:.PP.nf.br    QGLFormat f = QGLFormat::defaultOverlayFormat();.br    f.setDoubleBuffer( TRUE );.br    QGLFormat::setDefaultOverlayFormat( f );.fi.PPAs usual, you can test after the widget creation whether the underlying OpenGL system was able to provide the requested specification:.PP.nf.br    // (...continued from above).br    MyGLWidget* myWidget = new MyGLWidget( QGLFormat( QGL::HasOverlay ), ... );.br    if ( myWidget->format().hasOverlay() ) {.br      // Yes, we got an overlay, let's check _its_ format:.br      QGLContext* olContext = myWidget->overlayContext();.br      if ( olContext->format().doubleBuffer() ).br         ; // yes, we got a double buffered overlay.br      else.br         ; // no, only single buffered overlays were available.br    }.fi.PPSee also defaultOverlayFormat()..SH "void QGLFormat::setDepth ( bool enable )"Enables the depth buffer if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPThe depth buffer is enabled by default..PPThe purpose of a depth buffer (or z-buffering) is to remove hidden surfaces. Pixels are assigned z values based on the distance to the viewer. A pixel with a high z value is closer to the viewer than a pixel with a low z value. This information is used to decide whether to draw a pixel or not..PPSee also depth()..SH "void QGLFormat::setDirectRendering ( bool enable )"Enables direct rendering if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPDirect rendering is enabled by default..PPEnabling this option will make OpenGL bypass the underlying window system and render directly from hardware to the screen, if this is supported by the system..PPSee also directRendering()..SH "void QGLFormat::setDoubleBuffer ( bool enable )"Sets double buffering if \fIenable\fR is TRUE or single buffering if \fIenable\fR is FALSE..PPDouble buffering is enabled by default..PPDouble buffering is a technique where graphics is rendered to an off-screen buffer and not directly to the screen. When the drawing has been completed, the program calls a swapBuffers function to exchange the screen contents with the buffer. The result is flicker-free drawing and often better performance..PPSee also doubleBuffer(), QGLContext::swapBuffers() and QGLWidget::swapBuffers()..SH "void QGLFormat::setOption ( FormatOption opt )"Sets the option \fIopt.\fR.PPSee also testOption()..SH "void QGLFormat::setOverlay ( bool enable )"Enables an overlay plane if \fIenable\fR is TRUE; otherwise disables it..PPEnabling the overlay plane will cause QGLWidget to create an additional context in an overlay plane. See the QGLWidget documentation for further information..PPSee also hasOverlay()..SH "void QGLFormat::setPlane ( int plane )"Sets the requested plane. 0 is the normal plane, 1 is the first overlay plane, 2 is the second overlay plane, etc., and -1, -2, etc. are underlay planes..PPNote that, in contrast to the other format specifications, the plane specifications will be matched exactly. Thus, if you specify a plane that the underlying OpenGL system cannot provide, an invalid QGLWidget will be created..PPSee also plane()..SH "void QGLFormat::setRgba ( bool enable )"Sets RGBA mode if \fIenable\fR is TRUE, or color index mode if \fIenable\fR is FALSE..PPThe default color mode is RGBA..PPRGBA is the preferred mode for most OpenGL applications. In RGBA color mode you specify colors as a red + green + blue + alpha quadruplet..PPIn color index mode you specify an index into a color lookup table..PPSee also rgba()..SH "void QGLFormat::setStencil ( bool enable )"Enables the stencil buffer if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPThe stencil buffer is disabled by default..PPThe stencil buffer masks away drawing from certain parts of the screen..PPSee also stencil()..SH "void QGLFormat::setStereo ( bool enable )"Enables stereo buffering if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPStereo buffering is disabled by default..PPStereo buffering provides extra color buffers to generate left-eye and right-eye images..PPSee also stereo()..SH "bool QGLFormat::stencil () const"Returns TRUE if the stencil buffer is enabled, otherwise FALSE. The stencil buffer is disabled by default..PPSee also setStencil()..SH "bool QGLFormat::stereo () const"Returns TRUE if stereo buffering is enabled, otherwise FALSE. Stereo buffering is disabled by default..PPSee also setStereo()..SH "bool QGLFormat::testOption ( FormatOption opt ) const"Returns TRUE if format option \fIopt\fR is set, otherwise FALSE..PPSee also setOption()..SH RELATED FUNCTION DOCUMENTATION.SH "const char * qGLVersion ()"Returns the version number string for the Qt OpenGL extension,e.g. "1.0"..SH "SEE ALSO".BR http://doc.trolltech.com/qglformat.html.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -