Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QSurfaceFormat Class

The QSurfaceFormat class represents the format of a QSurface. More...

 #include <QSurfaceFormat>

This class was introduced in Qt 5.0.

Public Types

enum FormatOption { StereoBuffers, DebugContext, DeprecatedFunctions }
flags FormatOptions
enum OpenGLContextProfile { NoProfile, CoreProfile, CompatibilityProfile }
enum SwapBehavior { DefaultSwapBehavior, SingleBuffer, DoubleBuffer, TripleBuffer }

Public Functions

QSurfaceFormat()
QSurfaceFormat(FormatOptions options)
QSurfaceFormat(const QSurfaceFormat & other)
~QSurfaceFormat()
int alphaBufferSize() const
int blueBufferSize() const
int depthBufferSize() const
int greenBufferSize() const
bool hasAlpha() const
int majorVersion() const
int minorVersion() const
OpenGLContextProfile profile() const
int redBufferSize() const
int samples() const
void setAlphaBufferSize(int size)
void setBlueBufferSize(int size)
void setDepthBufferSize(int size)
void setGreenBufferSize(int size)
void setMajorVersion(int major)
void setMinorVersion(int minor)
void setOption(QSurfaceFormat::FormatOptions opt)
void setProfile(OpenGLContextProfile profile)
void setRedBufferSize(int size)
void setSamples(int numSamples)
void setStencilBufferSize(int size)
void setStereo(bool enable)
void setSwapBehavior(SwapBehavior behavior)
int stencilBufferSize() const
bool stereo() const
SwapBehavior swapBehavior() const
bool testOption(QSurfaceFormat::FormatOptions opt) const
QSurfaceFormat & operator=(const QSurfaceFormat & other)

Related Non-Members

bool operator!=(const QSurfaceFormat & a, const QSurfaceFormat & b)
bool operator==(const QSurfaceFormat & a, const QSurfaceFormat & b)

Detailed Description

The QSurfaceFormat class represents the format of a QSurface.

The format includes the size of the color buffers, red, green, and blue; the size of the alpha buffer; the size of the depth and stencil buffers; and number of samples per pixel for multisampling. In addition, the format contains surface configuration parameters such as OpenGL profile and version for rendering, whether or not enable stereo buffers, and swap behaviour.

Member Type Documentation

enum QSurfaceFormat::FormatOption
flags QSurfaceFormat::FormatOptions

This enum contains format options for use with QSurfaceFormat.

ConstantValueDescription
QSurfaceFormat::StereoBuffers0x0001Used to request stereo buffers in the surface format.
QSurfaceFormat::DebugContext0x0002Used to request a debug context with extra debugging information. This requires OpenGL version 3.0 or higher.
QSurfaceFormat::DeprecatedFunctions0x0004Used to request that deprecated functions be included in the OpenGL context profile. If not specified, you should get a forward compatible context without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher.

The FormatOptions type is a typedef for QFlags<FormatOption>. It stores an OR combination of FormatOption values.

enum QSurfaceFormat::OpenGLContextProfile

This enum is used to specify the OpenGL context profile, in conjunction with QSurfaceFormat::setMajorVersion() and QSurfaceFormat::setMinorVersion().

Profiles are exposed in OpenGL 3.2 and above, and are used to choose between a restricted core profile, and a compatibility profile which might contain deprecated support functionality.

Note that the core profile might still contain functionality that is deprecated and scheduled for removal in a higher version. To get access to the deprecated functionality for the core profile in the set OpenGL version you can use the QSurfaceFormat format option QSurfaceFormat::DeprecatedFunctions.

ConstantValueDescription
QSurfaceFormat::NoProfile0OpenGL version is lower than 3.2.
QSurfaceFormat::CoreProfile1Functionality deprecated in OpenGL version 3.0 is not available.
QSurfaceFormat::CompatibilityProfile2Functionality from earlier OpenGL versions is available.

enum QSurfaceFormat::SwapBehavior

This enum is used by QSurfaceFormat to specify the swap behaviour of a surface. The swap behaviour is mostly transparent to the application, but it affects factors such as rendering latency and throughput.

ConstantValueDescription
QSurfaceFormat::DefaultSwapBehavior0The default, unspecified swap behaviour of the platform.
QSurfaceFormat::SingleBuffer1Used to request single buffering, which might result in flickering when OpenGL rendering is done directly to screen without an intermediate offscreen buffer.
QSurfaceFormat::DoubleBuffer2This is typically the default swap behaviour on desktop platforms, consisting of one back buffer and one front buffer. Rendering is done to the back buffer, and then the back buffer and front buffer are swapped, or the contents of the back buffer are copied to the front buffer, depending on the implementation.
QSurfaceFormat::TripleBuffer3This swap behaviour is sometimes used in order to decrease the risk of skipping a frame when the rendering rate is just barely keeping up with the screen refresh rate. Depending on the platform it might also lead to slightly more efficient use of the GPU due to improved pipelining behaviour. Triple buffering comes at the cost of an extra frame of memory usage and latency, and might not be supported depending on the underlying platform.

Member Function Documentation

QSurfaceFormat::QSurfaceFormat()

Constructs a default initialized QSurfaceFormat.

QSurfaceFormat::QSurfaceFormat(FormatOptions options)

Constructs a QSurfaceFormat with the given format options.

QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat & other)

Constructs a copy of other.

QSurfaceFormat::~QSurfaceFormat()

Destroys the QSurfaceFormat.

int QSurfaceFormat::alphaBufferSize() const

Get the size in bits of the alpha channel of the color buffer.

See also setAlphaBufferSize().

int QSurfaceFormat::blueBufferSize() const

Get the size in bits of the blue channel of the color buffer.

See also setBlueBufferSize().

int QSurfaceFormat::depthBufferSize() const

Returns the depth buffer size.

See also depth(), setDepth(), and setDepthBufferSize().

int QSurfaceFormat::greenBufferSize() const

Get the size in bits of the green channel of the color buffer.

See also setGreenBufferSize().

bool QSurfaceFormat::hasAlpha() const

Returns true if the alpha buffer size is greater than zero.

This means that the surface might be used with per pixel translucency effects.

int QSurfaceFormat::majorVersion() const

Returns the major OpenGL version.

The default version is 2.0.

See also setMajorVersion().

int QSurfaceFormat::minorVersion() const

Returns the minor OpenGL version.

See also setMinorVersion().

OpenGLContextProfile QSurfaceFormat::profile() const

Get the configured OpenGL context profile.

This setting is ignored if the requested OpenGL version is less than 3.2.

See also setProfile().

int QSurfaceFormat::redBufferSize() const

Get the size in bits of the red channel of the color buffer.

See also setRedBufferSize().

int QSurfaceFormat::samples() const

Returns the number of samples per pixel when multisampling is enabled. By default, multisampling is disabled.

See also setSampleBuffers(), sampleBuffers(), and setSamples().

void QSurfaceFormat::setAlphaBufferSize(int size)

Set the desired size in bits of the alpha channel of the color buffer.

See also alphaBufferSize().

void QSurfaceFormat::setBlueBufferSize(int size)

Set the desired size in bits of the blue channel of the color buffer.

See also blueBufferSize().

void QSurfaceFormat::setDepthBufferSize(int size)

Set the minimum depth buffer size to size.

See also depthBufferSize(), setDepth(), and depth().

void QSurfaceFormat::setGreenBufferSize(int size)

Set the desired size in bits of the green channel of the color buffer.

See also greenBufferSize().

void QSurfaceFormat::setMajorVersion(int major)

Sets the desired major OpenGL version.

See also majorVersion().

void QSurfaceFormat::setMinorVersion(int minor)

Sets the desired minor OpenGL version.

The default version is 2.0.

See also minorVersion().

void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt)

Sets the format option to opt.

See also testOption().

void QSurfaceFormat::setProfile(OpenGLContextProfile profile)

Sets the desired OpenGL context profile.

This setting is ignored if the requested OpenGL version is less than 3.2.

See also profile().

void QSurfaceFormat::setRedBufferSize(int size)

Set the desired size in bits of the red channel of the color buffer.

See also redBufferSize().

void QSurfaceFormat::setSamples(int numSamples)

Set the preferred number of samples per pixel when multisampling is enabled to numSamples. By default, multisampling is disabled.

See also setSampleBuffers(), sampleBuffers(), and samples().

void QSurfaceFormat::setStencilBufferSize(int size)

Set the preferred stencil buffer size to size bits.

See also stencilBufferSize(), setStencil(), and stencil().

void QSurfaceFormat::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.

See also stereo().

void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior)

Set the swap behaviour of the surface.

The swap behaviour specifies whether single, double, or triple buffering is desired. The default, SwapBehavior::DefaultSwapBehavior, gives the default swap behavior of the platform.

See also swapBehavior().

int QSurfaceFormat::stencilBufferSize() const

Returns the stencil buffer size in bits.

See also stencil(), setStencil(), and setStencilBufferSize().

bool QSurfaceFormat::stereo() const

Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default.

See also setStereo().

SwapBehavior QSurfaceFormat::swapBehavior() const

Returns the configured swap behaviour.

See also setSwapBehavior().

bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const

Returns true if format option opt is set; otherwise returns false.

See also setOption().

QSurfaceFormat & QSurfaceFormat::operator=(const QSurfaceFormat & other)

Assigns other to this object.

Related Non-Members

bool operator!=(const QSurfaceFormat & a, const QSurfaceFormat & b)

Returns false if all the options of the two QSurfaceFormat objects a and b are equal; otherwise returns true.

bool operator==(const QSurfaceFormat & a, const QSurfaceFormat & b)

Returns true if all the options of the two QSurfaceFormat objects are equal.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web