Struct rute::auto::surface_format::SurfaceFormat
source · 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
sourceimpl<'a> SurfaceFormat<'a>
impl<'a> SurfaceFormat<'a>
pub fn new() -> SurfaceFormat<'a>
sourcepub fn set_depth_buffer_size(&self, size: i32) -> &Self
pub fn set_depth_buffer_size(&self, size: i32) -> &Self
Set the minimum depth buffer size to size.
See also: [depth_buffer_size()
]
sourcepub fn depth_buffer_size(&self) -> i32
pub fn depth_buffer_size(&self) -> i32
Returns the depth buffer size.
See also: [set_depth_buffer_size()
]
sourcepub fn set_stencil_buffer_size(&self, size: i32) -> &Self
pub fn set_stencil_buffer_size(&self, size: i32) -> &Self
Set the preferred stencil buffer size to size bits.
See also: [stencil_buffer_size()
]
sourcepub fn stencil_buffer_size(&self) -> i32
pub fn stencil_buffer_size(&self) -> i32
Returns the stencil buffer size in bits.
See also: [set_stencil_buffer_size()
]
sourcepub fn set_red_buffer_size(&self, size: i32) -> &Self
pub fn set_red_buffer_size(&self, size: i32) -> &Self
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.
sourcepub fn red_buffer_size(&self) -> i32
pub fn red_buffer_size(&self) -> i32
Get the size in bits of the red channel of the color buffer.
sourcepub fn set_green_buffer_size(&self, size: i32) -> &Self
pub fn set_green_buffer_size(&self, size: i32) -> &Self
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.
sourcepub fn green_buffer_size(&self) -> i32
pub fn green_buffer_size(&self) -> i32
Get the size in bits of the green channel of the color buffer.
sourcepub fn set_blue_buffer_size(&self, size: i32) -> &Self
pub fn set_blue_buffer_size(&self, size: i32) -> &Self
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.
sourcepub fn blue_buffer_size(&self) -> i32
pub fn blue_buffer_size(&self) -> i32
Get the size in bits of the blue channel of the color buffer.
sourcepub fn set_alpha_buffer_size(&self, size: i32) -> &Self
pub fn set_alpha_buffer_size(&self, size: i32) -> &Self
Set the desired size in bits of the alpha channel of the color buffer.
sourcepub fn alpha_buffer_size(&self) -> i32
pub fn alpha_buffer_size(&self) -> i32
Get the size in bits of the alpha channel of the color buffer.
sourcepub fn set_samples(&self, num_samples: i32) -> &Self
pub fn set_samples(&self, num_samples: i32) -> &Self
Set the preferred number of samples per pixel when multisampling is enabled to numSamples. By default, multisampling is disabled.
See also: [samples()
]
sourcepub fn samples(&self) -> i32
pub fn samples(&self) -> i32
Returns the number of samples per pixel when multisampling is enabled. By default, multisampling is disabled.
See also: [set_samples()
]
sourcepub fn set_swap_behavior(&self, behavior: SwapBehavior) -> &Self
pub fn set_swap_behavior(&self, behavior: SwapBehavior) -> &Self
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.
sourcepub fn swap_behavior(&self) -> SwapBehavior
pub fn swap_behavior(&self) -> SwapBehavior
Returns the configured swap behaviour.
See also: [set_swap_behavior()
]
sourcepub fn has_alpha(&self) -> bool
pub fn has_alpha(&self) -> bool
Returns true
if the alpha buffer size is greater than zero.
This means that the surface might be used with per pixel translucency effects.
sourcepub fn set_profile(&self, profile: OpenGLContextProfile) -> &Self
pub fn set_profile(&self, profile: OpenGLContextProfile) -> &Self
Sets the desired OpenGL context profile.
This setting is ignored if the requested OpenGL version is less than 3.2.
sourcepub fn profile(&self) -> OpenGLContextProfile
pub fn profile(&self) -> OpenGLContextProfile
Get the configured OpenGL context profile.
This setting is ignored if the requested OpenGL version is less than 3.2.
sourcepub fn set_renderable_type(&self, stype: RenderableType) -> &Self
pub fn set_renderable_type(&self, stype: RenderableType) -> &Self
Sets the desired renderable type.
Chooses between desktop OpenGL, OpenGL ES, and OpenVG.
sourcepub fn renderable_type(&self) -> RenderableType
pub fn renderable_type(&self) -> RenderableType
Gets the renderable type.
Chooses between desktop OpenGL, OpenGL ES, and OpenVG.
sourcepub fn set_major_version(&self, major_version: i32) -> &Self
pub fn set_major_version(&self, major_version: i32) -> &Self
Sets the desired major OpenGL version.
sourcepub fn major_version(&self) -> i32
pub fn major_version(&self) -> i32
Returns the major OpenGL version.
The default version is 2.0.
sourcepub fn set_minor_version(&self, minor_version: i32) -> &Self
pub fn set_minor_version(&self, minor_version: i32) -> &Self
Sets the desired minor OpenGL version.
The default version is 2.0.
sourcepub fn minor_version(&self) -> i32
pub fn minor_version(&self) -> i32
Returns the minor OpenGL version.
sourcepub fn set_version(&self, major: i32, minor: i32) -> &Self
pub fn set_version(&self, major: i32, minor: i32) -> &Self
Sets the desired major and minor OpenGL versions.
The default version is 2.0.
sourcepub fn stereo(&self) -> bool
pub fn stereo(&self) -> bool
Returns true
if stereo buffering is enabled; otherwise returns
false. Stereo buffering is disabled by default.
See also: [set_stereo()
]
sourcepub fn set_stereo(&self, enable: bool) -> &Self
pub fn set_stereo(&self, enable: bool) -> &Self
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()
]
sourcepub fn set_option(&self, opt: FormatOptions) -> &Self
pub fn set_option(&self, opt: FormatOptions) -> &Self
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()
]
sourcepub fn test_option(&self, opt: FormatOptions) -> bool
pub fn test_option(&self, opt: FormatOptions) -> bool
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()
]
sourcepub fn set_options(&self, options: FormatOptions) -> &Self
pub fn set_options(&self, options: FormatOptions) -> &Self
Sets the format options to options.
See also: [options()
]
[test_option()
]
sourcepub fn set_option_2(&self, option: FormatOption, on: bool) -> &Self
pub fn set_option_2(&self, option: FormatOption, on: bool) -> &Self
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()
]
sourcepub fn test_option_2(&self, option: FormatOption) -> bool
pub fn test_option_2(&self, option: FormatOption) -> bool
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()
]
sourcepub fn options(&self) -> FormatOptions
pub fn options(&self) -> FormatOptions
Returns the currently set format options.
See also: [set_option()
]
[set_options()
]
[test_option()
]
sourcepub fn swap_interval(&self) -> i32
pub fn swap_interval(&self) -> i32
Returns the swap interval.
See also: [set_swap_interval()
]
sourcepub fn set_swap_interval(&self, interval: i32) -> &Self
pub fn set_swap_interval(&self, interval: i32) -> &Self
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()
]
sourcepub fn color_space(&self) -> ColorSpace
pub fn color_space(&self) -> ColorSpace
Returns the color space.
See also: [set_color_space()
]
sourcepub fn set_color_space(&self, color_space: ColorSpace) -> &Self
pub fn set_color_space(&self, color_space: ColorSpace) -> &Self
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()
]
sourcepub fn set_default_format<S: SurfaceFormatTrait<'a>>(format: &S)
pub fn set_default_format<S: SurfaceFormatTrait<'a>>(format: &S)
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()
]
sourcepub fn default_format() -> SurfaceFormat<'a>
pub fn default_format() -> SurfaceFormat<'a>
Returns the global default surface format.
When setDefaultFormat() is not called, this is a default-constructed QSurfaceFormat.
See also: [set_default_format()
]
Trait Implementations
sourceimpl<'a> Clone for SurfaceFormat<'a>
impl<'a> Clone for SurfaceFormat<'a>
sourcefn clone(&self) -> SurfaceFormat<'a>
fn clone(&self) -> SurfaceFormat<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more