pub struct SurfaceFormat<'a> { /* private fields */ }
Expand description

Notice these docs are heavy WIP and not very relevent yet

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 to enable stereo buffers, and swap behaviour.

Note: When troubleshooting context or window format issues, it can be helpful to enable the logging category qt.qpa.gl . Depending on the platform, this may print useful debug information when it comes to OpenGL initialization and the native visual or framebuffer configurations which QSurfaceFormat gets mapped to.

Licence

The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.

Implementations

Set the minimum depth buffer size to size.

See also: [depth_buffer_size()]

Returns the depth buffer size.

See also: [set_depth_buffer_size()]

Set the preferred stencil buffer size to size bits.

See also: [stencil_buffer_size()]

Returns the stencil buffer size in bits.

See also: [set_stencil_buffer_size()]

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

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

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

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

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

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

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

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

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

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

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

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

See also: [samples()]

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

See also: [set_samples()]

Set the swap behavior of the surface.

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

Returns the configured swap behaviour.

See also: [set_swap_behavior()]

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

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

Sets the desired OpenGL context profile.

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

Get the configured OpenGL context profile.

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

Sets the desired renderable type.

Chooses between desktop OpenGL, OpenGL ES, and OpenVG.

Gets the renderable type.

Chooses between desktop OpenGL, OpenGL ES, and OpenVG.

Sets the desired major OpenGL version.

Returns the major OpenGL version.

The default version is 2.0.

Sets the desired minor OpenGL version.

The default version is 2.0.

Returns the minor OpenGL version.

Sets the desired major and minor OpenGL versions.

The default version is 2.0.

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

See also: [set_stereo()]

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()]

Overloads Use setOption(QSurfaceFormat::FormatOption, bool) or setOptions() instead.

Sets the format options to the OR combination of opt and the current format options.

See also: [options()] [test_option()]

Sets the format options to options.

See also: [options()] [test_option()]

Sets the format option option if on is true; otherwise, clears the option.

See also: [set_options()] [options()] [test_option()]

Overloads Use testOption(QSurfaceFormat::FormatOption) instead.

Returns true if any of the options in opt is currently set on this object; otherwise returns false.

See also: [set_option()]

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

See also: [options()]

Sets the format options to options.

See also: [options()] [test_option()]

Overloads Use setOption(QSurfaceFormat::FormatOption, bool) or setOptions() instead.

Sets the format options to the OR combination of opt and the current format options.

See also: [options()] [test_option()]

Sets the format options to options.

See also: [options()] [test_option()]

Sets the format option option if on is true; otherwise, clears the option.

See also: [set_options()] [options()] [test_option()]

Overloads Use testOption(QSurfaceFormat::FormatOption) instead.

Returns true if any of the options in opt is currently set on this object; otherwise returns false.

See also: [set_option()]

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

See also: [options()]

Returns the currently set format options.

See also: [set_option()] [set_options()] [test_option()]

Returns the swap interval.

See also: [set_swap_interval()]

Sets the preferred swap interval. The swap interval specifies the minimum number of video frames that are displayed before a buffer swap occurs. This can be used to sync the GL drawing into a 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. Setting interval to a higher value, for example 10, results in having 10 vertical retraces between every buffer swap.

The default interval is 1.

Changing the swap interval may not be supported by the underlying platform. In this case, the request will be silently ignored.

See also: [swap_interval()]

Returns the color space.

See also: [set_color_space()]

Sets the preferred colorSpace.

For example, this allows requesting windows with default framebuffers that are sRGB-capable on platforms that support it.

Note: When the requested color space is not supported by the platform, the request is ignored. Query the QSurfaceFormat after window creation to verify if the color space request could be honored or not.

Note: This setting controls if the default framebuffer of the window is capable of updates and blending in a given color space. It does not change applications’ output by itself. The applications’ rendering code will still have to opt in via the appropriate OpenGL calls to enable updates and blending to be performed in the given color space instead of using the standard linear operations.

See also: [color_space()]

Sets the global default surface format.

This format is used by default in QOpenGLContext, QWindow, QOpenGLWidget and similar classes.

It can always be overridden on a per-instance basis by using the class in question’s own setFormat() function. However, it is often more convenient to set the format for all windows once at the start of the application. It also guarantees proper behavior in cases where shared contexts are required, because settings the format via this function guarantees that all contexts and surfaces, even the ones created internally by Qt, will use the same format.

Note: When setting Qt::AA_ShareOpenGLContexts, it is strongly recommended to place the call to this function before the construction of the QGuiApplication or QApplication. Otherwise format will not be applied to the global share context and therefore issues may arise with context sharing afterwards.

See also: [default_format()]

Returns the global default surface format.

When setDefaultFormat() is not called, this is a default-constructed QSurfaceFormat.

See also: [set_default_format()]

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.