Member Function Documentation
QPlatformWindowFormat::QPlatformWindowFormat ()
Constructs a QPlatformWindowFormat object with the following default settings:
QPlatformWindowFormat::QPlatformWindowFormat ( FormatOptions options )
Creates a QPlatformWindowFormat object that is a copy of the current defaultFormat().
If options is not 0, the default format is modified by the specified format options. The options parameter should be QGL::FormatOption values OR'ed together.
This constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example:
MyGLWidget::MyGLWidget(QWidget* parent)
: QGLWidget(QGLFormat(QGL::StencilBuffer | QGL::AlphaChannel), parent)
{
if (!format().stencil())
qWarning("Could not get stencil buffer; results will be suboptimal");
if (!format().alpha())
qWarning("Could not get alpha channel; results will be suboptimal");
...
}
Note that there are QGL::FormatOption values to turn format settings both on and off; e.g., QGL::DepthBuffer and QGL::NoDepthBuffer, QGL::DirectRendering and QGL::IndirectRendering, etc.
See also defaultFormat() and setOption().
QPlatformWindowFormat::QPlatformWindowFormat ( const QPlatformWindowFormat & other )
Constructs a copy of other.
QPlatformWindowFormat::~QPlatformWindowFormat ()
Destroys the QPlatformWindowFormat.
bool QPlatformWindowFormat::accum () const
Returns true if the accumulation buffer is enabled; otherwise returns false. The accumulation buffer is disabled by default.
See also setAccum() and setAccumBufferSize().
int QPlatformWindowFormat::accumBufferSize () const
Returns the accumulation buffer size.
See also setAccumBufferSize(), accum(), and setAccum().
bool QPlatformWindowFormat::alpha () const
Returns true if the alpha buffer in the framebuffer is enabled; otherwise returns false. The alpha buffer is disabled by default.
See also setAlpha() and setAlphaBufferSize().
int QPlatformWindowFormat::alphaBufferSize () const
Returns the alpha buffer size.
See also alpha(), setAlpha(), and setAlphaBufferSize().
int QPlatformWindowFormat::blueBufferSize () const
Returns the blue buffer size.
This function was introduced in Qt 4.2.
See also setBlueBufferSize().
QPlatformWindowFormat QPlatformWindowFormat::defaultFormat () [static]
Returns the default QPlatformWindowFormat for the application. All QGLWidget objects 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 QPlatformWindowFormat().
See also setDefaultFormat().
bool QPlatformWindowFormat::depth () const
Returns true if the depth buffer is enabled; otherwise returns false. The depth buffer is enabled by default.
See also setDepth() and setDepthBufferSize().
int QPlatformWindowFormat::depthBufferSize () const
Returns the depth buffer size.
See also depth(), setDepth(), and setDepthBufferSize().
bool QPlatformWindowFormat::directRendering () const
Returns true if direct rendering is enabled; otherwise returns false.
Direct rendering is enabled by default.
See also setDirectRendering().
bool QPlatformWindowFormat::doubleBuffer () const
Returns true if double buffering is enabled; otherwise returns false. Double buffering is enabled by default.
See also setDoubleBuffer().
int QPlatformWindowFormat::greenBufferSize () const
Returns the green buffer size.
This function was introduced in Qt 4.2.
See also setGreenBufferSize().
bool QPlatformWindowFormat::hasWindowSurface () const
Returns true if the corresponding widget has an instance of QWindowSurface.
Otherwise returns false.
WindowSurface is enabled by default.
int QPlatformWindowFormat::redBufferSize () const
Returns the red buffer size.
This function was introduced in Qt 4.2.
See also setRedBufferSize().
bool QPlatformWindowFormat::rgba () const
Returns true if RGBA color mode is set. Returns false if color index mode is set. The default color mode is RGBA.
See also setRgba().
bool QPlatformWindowFormat::sampleBuffers () const
Returns true if multisample buffer support is enabled; otherwise returns false.
The multisample buffer is disabled by default.
See also setSampleBuffers().
int QPlatformWindowFormat::samples () const
Returns the number of samples per pixel when multisampling is enabled. By default, the highest number of samples that is available is used.
See also setSampleBuffers(), sampleBuffers(), and setSamples().
void QPlatformWindowFormat::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.
See also accum() and setAccumBufferSize().
void QPlatformWindowFormat::setAccumBufferSize ( int size )
Set the preferred accumulation buffer size, where size is the bit depth for each RGBA component.
See also accum(), setAccum(), and accumBufferSize().
void QPlatformWindowFormat::setAlpha ( bool enable )
If enable is true enables the alpha buffer; otherwise disables the alpha buffer.
The alpha buffer is disabled by default.
The alpha buffer is typically used for implementing transparency or translucency. The A in RGBA specifies the transparency of a pixel.
See also alpha() and setAlphaBufferSize().
void QPlatformWindowFormat::setAlphaBufferSize ( int size )
Set the preferred alpha buffer size to size. This function implicitly enables the alpha channel.
See also setRedBufferSize(), setGreenBufferSize(), and alphaBufferSize().
void QPlatformWindowFormat::setBlueBufferSize ( int size )
Set the preferred blue buffer size to size.
This function was introduced in Qt 4.2.
See also blueBufferSize(), setRedBufferSize(), setGreenBufferSize(), and setAlphaBufferSize().
void QPlatformWindowFormat::setDefaultFormat ( const QPlatformWindowFormat & f ) [static]
Sets a new default QPlatformWindowFormat 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:
QApplication a(argc, argv);
QGLFormat f;
f.setDoubleBuffer(false);
QGLFormat::setDefaultFormat(f);
See also defaultFormat().
void QPlatformWindowFormat::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.
See also depth() and setDepthBufferSize().
void QPlatformWindowFormat::setDepthBufferSize ( int size )
Set the minimum depth buffer size to size.
See also depthBufferSize(), setDepth(), and depth().
void QPlatformWindowFormat::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.
See also directRendering().
void QPlatformWindowFormat::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.
See also doubleBuffer(), QGLContext::swapBuffers(), and QGLWidget::swapBuffers().
void QPlatformWindowFormat::setGreenBufferSize ( int size )
Set the preferred green buffer size to size.
This function was introduced in Qt 4.2.
See also greenBufferSize(), setRedBufferSize(), setBlueBufferSize(), and setAlphaBufferSize().
Sets the format option to opt.
See also testOption().
void QPlatformWindowFormat::setRedBufferSize ( int size )
Set the preferred red buffer size to size.
This function was introduced in Qt 4.2.
See also redBufferSize(), setGreenBufferSize(), setBlueBufferSize(), and setAlphaBufferSize().
void QPlatformWindowFormat::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.
See also rgba().
void QPlatformWindowFormat::setSampleBuffers ( bool enable )
If enable is true, a GL context with multisample buffer support is picked; otherwise ignored.
See also sampleBuffers(), setSamples(), and samples().
void QPlatformWindowFormat::setSamples ( int numSamples )
Set the preferred number of samples per pixel when multisampling is enabled to numSamples. By default, the highest number of samples available is used.
See also setSampleBuffers(), sampleBuffers(), and samples().
void QPlatformWindowFormat::setSharedContext ( QPlatformGLContext * context )
void QPlatformWindowFormat::setStencil ( bool enable )
If enable is true enables the stencil buffer; otherwise disables the stencil buffer.
The stencil buffer is enabled by default.
The stencil buffer masks certain parts of the drawing area so that masked parts are not drawn on.
See also stencil() and setStencilBufferSize().
void QPlatformWindowFormat::setStencilBufferSize ( int size )
Set the preferred stencil buffer size to size.
See also stencilBufferSize(), setStencil(), and stencil().
void QPlatformWindowFormat::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 QPlatformWindowFormat::setSwapInterval ( int interval )
Set the preferred swap interval. This can be used to sync the GL drawing into a system window to the vertical refresh of the screen. Setting an interval value of 0 will turn the vertical refresh syncing off, any value higher than 0 will turn the vertical syncing on.
Under Windows and under X11, where the WGL_EXT_swap_control and GLX_SGI_video_sync extensions are used, the interval parameter can be used to set the minimum number of video frames that are displayed before a buffer swap will occur. In effect, setting the interval to 10, means there will be 10 vertical retraces between every buffer swap.
Under Windows the WGL_EXT_swap_control extension has to be present, and under X11 the GLX_SGI_video_sync extension has to be present.
This function was introduced in Qt 4.2.
See also swapInterval().
See also windowApi().
void QPlatformWindowFormat::setWindowSurface ( bool enable )
If enable is true a top level QWidget will create a QWindowSurface at creation;
otherwise the QWidget will only have a QPlatformWindow.
This is useful for QGLWidget where the QPlatformGLContext controls the surface.
See also hasWindowSurface().
QPlatformGLContext * QPlatformWindowFormat::sharedGLContext () const
bool QPlatformWindowFormat::stencil () const
Returns true if the stencil buffer is enabled; otherwise returns false. The stencil buffer is enabled by default.
See also setStencil() and setStencilBufferSize().
int QPlatformWindowFormat::stencilBufferSize () const
Returns the stencil buffer size.
See also stencil(), setStencil(), and setStencilBufferSize().
bool QPlatformWindowFormat::stereo () const
Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default.
See also setStereo().
int QPlatformWindowFormat::swapInterval () const
Returns the currently set swap interval. -1 is returned if setting the swap interval isn't supported in the system GL implementation.
This function was introduced in Qt 4.2.
See also setSwapInterval().
Returns true if format option opt is set; otherwise returns false.
See also setOption().
WindowApi QPlatformWindowFormat::windowApi () const
See also setWindowApi().
QPlatformWindowFormat & QPlatformWindowFormat::operator= ( const QPlatformWindowFormat & other )
Assigns other to this object.