Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos públicos estáticos | Amigas
Referencia de la Clase QGLFormat

The QGLFormat class specifies the display format of an OpenGL rendering context.OpenGL. Más...

#include <qgl.h>

Diagrama de herencias de QGLFormat
QGL QGL

Lista de todos los miembros.

Métodos públicos

 QGLFormat ()
 QGLFormat (int options, int plane=0)
bool doubleBuffer () const
void setDoubleBuffer (bool enable)
bool depth () const
void setDepth (bool enable)
bool rgba () const
void setRgba (bool enable)
bool alpha () const
void setAlpha (bool enable)
bool accum () const
void setAccum (bool enable)
bool stencil () const
void setStencil (bool enable)
bool stereo () const
void setStereo (bool enable)
bool directRendering () const
void setDirectRendering (bool enable)
bool hasOverlay () const
void setOverlay (bool enable)
int plane () const
void setPlane (int plane)
void setOption (FormatOption opt)
bool testOption (FormatOption opt) const
 QGLFormat ()
 QGLFormat (int options, int plane=0)
bool doubleBuffer () const
void setDoubleBuffer (bool enable)
bool depth () const
void setDepth (bool enable)
bool rgba () const
void setRgba (bool enable)
bool alpha () const
void setAlpha (bool enable)
bool accum () const
void setAccum (bool enable)
bool stencil () const
void setStencil (bool enable)
bool stereo () const
void setStereo (bool enable)
bool directRendering () const
void setDirectRendering (bool enable)
bool hasOverlay () const
void setOverlay (bool enable)
int plane () const
void setPlane (int plane)
void setOption (FormatOption opt)
bool testOption (FormatOption opt) const

Métodos públicos estáticos

static QGLFormat defaultFormat ()
static void setDefaultFormat (const QGLFormat &f)
static QGLFormat defaultOverlayFormat ()
static void setDefaultOverlayFormat (const QGLFormat &f)
static bool hasOpenGL ()
static bool hasOpenGLOverlays ()
static QGLFormat defaultFormat ()
static void setDefaultFormat (const QGLFormat &f)
static QGLFormat defaultOverlayFormat ()
static void setDefaultOverlayFormat (const QGLFormat &f)
static bool hasOpenGL ()
static bool hasOpenGLOverlays ()

Amigas

QM_EXPORT_OPENGL bool operator== (const QGLFormat &, const QGLFormat &)
QM_EXPORT_OPENGL bool operator!= (const QGLFormat &, const QGLFormat &)
QM_EXPORT_OPENGL bool operator== (const QGLFormat &, const QGLFormat &)
QM_EXPORT_OPENGL bool operator!= (const QGLFormat &, const QGLFormat &)

Descripción detallada

The QGLFormat class specifies the display format of an OpenGL rendering context.

OpenGL.

A display format has several characteristics: Double or single buffering. Depth buffer. RGBA or color index mode. Alpha channel. Accumulation buffer. Stencil buffer. Stereo buffers. Direct rendering. Presence of an overlay. The plane of an overlay format.

You create and tell a QGLFormat object what rendering options you want from an OpenGL* rendering context.

OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you create a QGLWidget, you will get a rendering context with the nearest subset of features.

There are different ways to define the display characteristics of a rendering context. One is to create a QGLFormat and make it the default for the entire application:

Or you can specify the desired format when creating an object of your QGLWidget subclass:

    QGLFormat f;
    f.setDoubleBuffer( FALSE );                 // single buffer
    f.setDirectRendering( FALSE );              // software rendering
    MyGLWidget* myWidget = new MyGLWidget( f, ... );

After the widget has been created, you can find out which of the requested features the system was able to provide:

    QGLFormat f;
    f.setOverlay( TRUE );
    f.setStereo( TRUE );
    MyGLWidget* myWidget = new MyGLWidget( f, ... );
    if ( !w->format().stereo() ) {
        // ok, goggles off
        if ( !w->format().hasOverlay() ) {
            qFatal( "Cool hardware required" );
        }
    }

* OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.

Ver también:
QGLContext, QGLWidget

Documentación del constructor y destructor

QGLFormat::QGLFormat ( )

Constructs a QGLFormat object with the factory default settings: Double buffer: Enabled. Depth buffer: Enabled. RGBA: Enabled (i.e., color index disabled). Alpha channel: Disabled. Accumulator buffer: Disabled. Stencil buffer: Disabled. Stereo: Disabled. Direct rendering: Enabled. Overlay: Disabled. Plane: 0 (i.e., normal plane).

QGLFormat::QGLFormat ( int  options,
int  plane = 0 
)

Creates a QGLFormat object that is a copy of the current application default format.

If options is not 0, this copy is modified by these format options. The options parameter should be FormatOption values OR'ed together.

This constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example:

    // The rendering in MyGLWidget depends on using
    // stencil buffer and alpha channel
    MyGLWidget::MyGLWidget( QWidget* parent, const char* name )
        : QGLWidget( QGLFormat( StencilBuffer | AlphaChannel ), parent, name )
    {
        if ( !format().stencil() )
            qWarning( "Could not get stencil buffer; results will be suboptimal" );
        if ( !format().alphaChannel() )
            qWarning( "Could not get alpha channel; results will be suboptimal" );
        ...
    }

Note that there are FormatOption values to turn format settings both on and off, e.g. DepthBuffer and NoDepthBuffer, DirectRendering and IndirectRendering, etc.

The plane parameter defaults to 0 and is the plane which this format should be associated with. Not all OpenGL implmentations supports overlay/underlay rendering planes.

Ver también:
defaultFormat(), setOption()
QGLFormat::QGLFormat ( )
QGLFormat::QGLFormat ( int  options,
int  plane = 0 
)

Documentación de las funciones miembro

bool QGLFormat::accum ( ) const [inline]

Returns TRUE if the accumulation buffer is enabled; otherwise returns FALSE. The accumulation buffer is disabled by default.

Ver también:
setAccum()
bool QGLFormat::accum ( ) const
bool QGLFormat::alpha ( ) const [inline]

Returns TRUE if the alpha channel of the framebuffer is enabled; otherwise returns FALSE. The alpha channel is disabled by default.

Ver también:
setAlpha()
bool QGLFormat::alpha ( ) const
QGLFormat QGLFormat::defaultFormat ( ) [static]

Returns the default QGLFormat for the application. All QGLWidgets that are created use this format unless another format is specified, e.g. when they are constructed.

If no special default format has been set using setDefaultFormat(), the default format is the same as that created with QGLFormat().

Ver también:
setDefaultFormat()
static QGLFormat QGLFormat::defaultFormat ( ) [static]
QGLFormat QGLFormat::defaultOverlayFormat ( ) [static]

Returns the default QGLFormat for overlay contexts.

The factory default overlay format is: Double buffer: Disabled. Depth buffer: Disabled. RGBA: Disabled (i.e., color index enabled). Alpha channel: Disabled. Accumulator buffer: Disabled. Stencil buffer: Disabled. Stereo: Disabled. Direct rendering: Enabled. Overlay: Disabled. Plane: 1 (i.e., first overlay plane).

Ver también:
setDefaultFormat()
static QGLFormat QGLFormat::defaultOverlayFormat ( ) [static]
bool QGLFormat::depth ( ) const [inline]

Returns TRUE if the depth buffer is enabled; otherwise returns FALSE. The depth buffer is enabled by default.

Ver también:
setDepth()
bool QGLFormat::depth ( ) const
bool QGLFormat::directRendering ( ) const
bool QGLFormat::directRendering ( ) const [inline]

Returns TRUE if direct rendering is enabled; otherwise returns FALSE.

Direct rendering is enabled by default.

Ver también:
setDirectRendering()
bool QGLFormat::doubleBuffer ( ) const
bool QGLFormat::doubleBuffer ( ) const [inline]

Returns TRUE if double buffering is enabled; otherwise returns FALSE. Double buffering is enabled by default.

Ver también:
setDoubleBuffer()
bool QGLFormat::hasOpenGL ( ) [static]

Returns TRUE if the window system has any OpenGL support; otherwise returns FALSE.

Atención:
This function must not be called until the QApplication object has been created.
static bool QGLFormat::hasOpenGL ( ) [static]
static bool QGLFormat::hasOpenGLOverlays ( ) [static]
bool QGLFormat::hasOpenGLOverlays ( ) [static]

Returns TRUE if the window system supports OpenGL overlays; otherwise returns FALSE.

Atención:
This function must not be called until the QApplication object has been created.
bool QGLFormat::hasOverlay ( ) const [inline]

Returns TRUE if overlay plane is enabled; otherwise returns FALSE.

Overlay is disabled by default.

Ver también:
setOverlay()
bool QGLFormat::hasOverlay ( ) const
int QGLFormat::plane ( ) const

Returns the plane of this format. The default for normal formats is 0, which means the normal plane. The default for overlay formats is 1, which is the first overlay plane.

Ver también:
setPlane()
int QGLFormat::plane ( ) const
bool QGLFormat::rgba ( ) const
bool QGLFormat::rgba ( ) const [inline]

Returns TRUE if RGBA color mode is set. Returns FALSE if color index mode is set. The default color mode is RGBA.

Ver también:
setRgba()
void QGLFormat::setAccum ( bool  enable)
void QGLFormat::setAccum ( bool  enable)

If enable is TRUE enables the accumulation buffer; otherwise disables the accumulation buffer.

The accumulation buffer is disabled by default.

The accumulation buffer is used to create blur effects and multiple exposures.

Ver también:
accum()
void QGLFormat::setAlpha ( bool  enable)
void QGLFormat::setAlpha ( bool  enable)

If enable is TRUE enables the alpha channel; otherwise disables the alpha channel.

The alpha buffer is disabled by default.

The alpha channel is typically used for implementing transparency or translucency. The A in RGBA specifies the transparency of a pixel.

Ver también:
alpha()
static void QGLFormat::setDefaultFormat ( const QGLFormat f) [static]
void QGLFormat::setDefaultFormat ( const QGLFormat f) [static]

Sets a new default QGLFormat for the application to f. For example, to set single buffering as the default instead of double buffering, your main() might contain code like this:

Ver también:
defaultFormat()
void QGLFormat::setDefaultOverlayFormat ( const QGLFormat f) [static]

Sets a new default QGLFormat for overlay contexts to f. This format is used whenever a QGLWidget is created with a format that hasOverlay() enabled.

For example, to get a double buffered overlay context (if available), use code like this:

As usual, you can find out after widget creation whether the underlying OpenGL system was able to provide the requested specification:

    // ...continued from above
    MyGLWidget* myWidget = new MyGLWidget( QGLFormat( QGL::HasOverlay ), ... );
    if ( myWidget->format().hasOverlay() ) {
        // Yes, we got an overlay, let's check _its_ format:
        QGLContext* olContext = myWidget->overlayContext();
        if ( olContext->format().doubleBuffer() )
            ; // yes, we got a double buffered overlay
        else
            ; // no, only single buffered overlays are available
    }
Ver también:
defaultOverlayFormat()
static void QGLFormat::setDefaultOverlayFormat ( const QGLFormat f) [static]
void QGLFormat::setDepth ( bool  enable)
void QGLFormat::setDepth ( bool  enable)

If enable is TRUE enables the depth buffer; otherwise disables the depth buffer.

The depth buffer is enabled by default.

The 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.

Ver también:
depth()
void QGLFormat::setDirectRendering ( bool  enable)

If enable is TRUE enables direct rendering; otherwise disables direct rendering.

Direct rendering is enabled by default.

Enabling 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.

Ver también:
directRendering()
void QGLFormat::setDirectRendering ( bool  enable)
void QGLFormat::setDoubleBuffer ( bool  enable)

If enable is TRUE sets double buffering; otherwise sets single buffering.

Double buffering is enabled by default.

Double buffering is a technique where graphics are rendered on 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.

Ver también:
doubleBuffer(), QGLContext::swapBuffers(), QGLWidget::swapBuffers()
void QGLFormat::setDoubleBuffer ( bool  enable)
void QGLFormat::setOption ( FormatOption  opt)

Sets the format option to opt.

Ver también:
testOption()
void QGLFormat::setOption ( FormatOption  opt)
void QGLFormat::setOverlay ( bool  enable)
void QGLFormat::setOverlay ( bool  enable)

If enable is TRUE enables an overlay plane; otherwise disables the overlay plane.

Enabling the overlay plane will cause QGLWidget to create an additional context in an overlay plane. See the QGLWidget documentation for further information.

Ver también:
hasOverlay()
void QGLFormat::setPlane ( int  plane)
void QGLFormat::setPlane ( int  plane)

Sets the requested plane to plane. 0 is the normal plane, 1 is the first overlay plane, 2 is the second overlay plane, etc.; -1, -2, etc. are underlay planes.

Note that in contrast to other format specifications, the plane specifications will be matched exactly. This means that if you specify a plane that the underlying OpenGL system cannot provide, an invalid QGLWidget will be created.

Ver también:
plane()
void QGLFormat::setRgba ( bool  enable)
void QGLFormat::setRgba ( bool  enable)

If enable is TRUE sets RGBA mode. If enable is FALSE sets color index mode.

The default color mode is RGBA.

RGBA is the preferred mode for most OpenGL applications. In RGBA color mode you specify colors as red + green + blue + alpha quadruplets.

In color index mode you specify an index into a color lookup table.

Ver también:
rgba()
void QGLFormat::setStencil ( bool  enable)
void QGLFormat::setStencil ( bool  enable)

If enable is TRUE enables the stencil buffer; otherwise disables the stencil buffer.

The stencil buffer is disabled by default.

The stencil buffer masks certain parts of the drawing area so that masked parts are not drawn on.

Ver también:
stencil()
void QGLFormat::setStereo ( bool  enable)
void QGLFormat::setStereo ( bool  enable)

If enable is TRUE enables stereo buffering; otherwise disables stereo buffering.

Stereo buffering is disabled by default.

Stereo buffering provides extra color buffers to generate left-eye and right-eye images.

Ver también:
stereo()
bool QGLFormat::stencil ( ) const
bool QGLFormat::stencil ( ) const [inline]

Returns TRUE if the stencil buffer is enabled; otherwise returns FALSE. The stencil buffer is disabled by default.

Ver también:
setStencil()
bool QGLFormat::stereo ( ) const
bool QGLFormat::stereo ( ) const [inline]

Returns TRUE if stereo buffering is enabled; otherwise returns FALSE. Stereo buffering is disabled by default.

Ver también:
setStereo()
bool QGLFormat::testOption ( FormatOption  opt) const

Returns TRUE if format option opt is set; otherwise returns FALSE.

Ver también:
setOption()
bool QGLFormat::testOption ( FormatOption  opt) const

Documentación de las funciones relacionadas y clases amigas

QM_EXPORT_OPENGL bool operator!= ( const QGLFormat ,
const QGLFormat  
) [friend]

Returns FALSE if all the options of the two QGLFormats are equal; otherwise returns TRUE.

QM_EXPORT_OPENGL bool operator!= ( const QGLFormat ,
const QGLFormat  
) [friend]

Returns FALSE if all the options of the two QGLFormats are equal; otherwise returns TRUE.

QM_EXPORT_OPENGL bool operator== ( const QGLFormat ,
const QGLFormat  
) [friend]

Returns TRUE if all the options of the two QGLFormats are equal; otherwise returns FALSE.

QM_EXPORT_OPENGL bool operator== ( const QGLFormat ,
const QGLFormat  
) [friend]

Returns TRUE if all the options of the two QGLFormats are equal; otherwise returns FALSE.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'