ARTICLE: "ui.pixel-formats-attributes""Pixel format attributes"
"The following pixel format attributes can be requested and queried of " { $link pixel-format } "s. Binary attributes are represented by the presence of a symbol in an attribute sequence:"
{ $subsection double-buffered }
{ $subsection stereo }
{ $subsection offscreen }
{ $subsection fullscreen }
{ $subsection windowed }
{ $subsection accelerated }
{ $subsection software-rendered }
{ $subsection backing-store }
{ $subsection multisampled }
{ $subsection supersampled }
{ $subsection sample-alpha }
{ $subsection color-float }
"Integer attributes are represented by a " { $link tuple } " with a single " { $snippet "value" } "slot:"
{ $subsection color-bits }
{ $subsection red-bits }
{ $subsection green-bits }
{ $subsection blue-bits }
{ $subsection alpha-bits }
{ $subsection accum-bits }
{ $subsection accum-red-bits }
{ $subsection accum-green-bits }
{ $subsection accum-blue-bits }
{ $subsection accum-alpha-bits }
{ $subsection depth-bits }
{ $subsection stencil-bits }
{ $subsection aux-buffers }
{ $subsection sample-buffers }
{ $subsection samples }
{ $examples
"The following " { $link world } " subclass will request a double-buffered window with minimum 24-bit color and depth buffers, and will throw an error if the requirements aren't met:"
{ $class-description "Requests a double-buffered pixel format." } ;
HELP:stereo
{ $class-description "Requests a stereoscopic pixel format." } ;
HELP:offscreen
{ $class-description "Requests a pixel format suitable for offscreen rendering." } ;
HELP:fullscreen
{ $class-description "Requests a pixel format suitable for fullscreen rendering." }
{ $notes "On some window systems this is not distinct from " { $link windowed } "." } ;
HELP:windowed
{ $class-description "Requests a pixel format suitable for rendering to a window." } ;
{ offscreen fullscreen windowed } related-words
HELP:accelerated
{ $class-description "Requests a pixel format supported by GPU hardware acceleration." } ;
HELP:software-rendered
{ $class-description "Requests a pixel format only supported by the window system's default software renderer." } ;
{ accelerated software-rendered } related-words
HELP:backing-store
{ $class-description "Used with " { $link double-buffered } " to request a double-buffered pixel format where the back buffer contents are preserved and copied to the front when buffers are swapped." } ;
{ $class-description "Requests a pixel format with multisampled antialiasing enabled. The " { $link sample-buffers } " and " { $link samples } " attributes must also be provided to specify the level of multisampling." }
{ $class-description "Requests a pixel format with supersampled antialiasing enabled. The " { $link sample-buffers } " and " { $link samples } " attributes must also be provided to specify the level of supersampling." }
{ $class-description "Requests a pixel format with a depth buffer of at least " { $snippet "value" } " bits per pixel." } ;
HELP:stencil-bits
{ $class-description "Requests a pixel format with a stencil buffer of at least " { $snippet "value" } " bits per pixel." } ;
HELP:aux-buffers
{ $class-description "Requests a pixel format with at least " { $snippet "value" } " auxiliary buffers." } ;
HELP:sample-buffers
{ $class-description "Used with " { $link multisampled } " or " { $link supersampled } " to request a pixel format with at least " { $snippet "value" } " sampling buffers." } ;
HELP:samples
{ $class-description "Used with " { $link multisampled } " or " { $link supersampled } " to request at least " { $snippet "value" } " samples per pixel." } ;
{ $values { "world" world } { "attributes"sequence } }
{ $description "Returns the set of " { $link "ui.pixel-formats-attributes" } " that " { $snippet "world" } " requests when grafted. This generic can be overridden by subclasses of " { $snippet "world" } "." }
{ $notes "The pixel format provided by the window system will not necessarily exactly match the requested attributes. To verify required pixel format attributes, override " { $link check-world-pixel-format } "." } ;
{ $description "Verifies that " { $snippet "pixel-format" } " fulfills the requirements of " { $snippet "world" } ". The default method does nothing. Subclasses can override this generic to perform their own checks on the pixel format." } ;
HELP:pixel-format
{ $class-description "The type of pixel format objects. The tuple slot contents should be considered opaque by user code. To check the value of a pixel format's attributes, use the " { $link pixel-format-attribute } " word. Pixel format objects must be freed using the " { $link dispose } " word when they are no longer needed." } ;
{ $description "Requests a pixel format suitable for " { $snippet "world" } " with a set of " { $link "ui.pixel-formats-attributes" } ". If no pixel format can be found that satisfies the given attributes, an " { $link invalid-pixel-format-attributes } " error is thrown. Pixel format attributes not supported by the window system are ignored. The returned " { $snippet "pixel-format" } " must be released using the " { $link dispose } " word when it is no longer needed." }
{ $notes "Pixel formats don't normally need to be directly allocated by user code. If you need to control the pixel format requested by a window, subclass " { $snippet "world" } " and override the " { $link world-pixel-format-attributes } " and " { $link check-world-pixel-format } " words."
$nl
"The returned pixel format does not necessarily exactly match the requested attributes; the window system will try to find the format that best matches the given attributes. Use " { $link pixel-format-attribute } " to check the actual values of the attributes on the returned pixel format." }
;
HELP:pixel-format-attribute
{ $values { "pixel-format" pixel-format } { "attribute-name""one of the " { $link "ui.pixel-formats-attributes" } } { "value"object } }
{ $description "Returns the value of the requested " { $snippet "attribute-name" } " in " { $snippet "pixel-format" } ". If " { "attribute-name" } " is unsupported by the window system, " { $link f } " is returned." } ;
HELP:invalid-pixel-format-attributes
{ $values { "world" world } { "attributes"sequence } }
{ $class-description "Thrown by " { $link <pixel-format> } " when the window system is unable to find a pixel format for " { $snippet "world" } " that satisfies the requested " { $snippet "attributes" } "." } ;
"The UI allows you to control the window system's OpenGL interface with a cross-platform set of pixel format specifiers:"
{ $subsection "ui.pixel-formats-attributes" }
"Pixel formats can be requested using these attributes:"
{ $subsection pixel-format }
{ $subsection <pixel-format> }
{ $subsection pixel-format-attribute }
"If a request for a set of pixel format attributes cannot be satisfied, an error is thrown:"
{ $subsection invalid-pixel-format-attributes }
"Pixel formats are requested as part of opening a window for a " { $link world } ". These generics can be overridden on " { $snippet "world" } " subclasses to control pixel format selection:"