Struct ContextValues
Values describing the full specification of a OpenGL context's backbuffer.
Assembly: OpenTK.Platform.dll
Syntax
public struct ContextValues : IEquatable<ContextValues>
Constructors
ContextValues(ulong, int, int, int, int, int, int, bool, bool, ContextPixelFormat, ContextSwapMethod, int)
Declaration
public ContextValues(ulong id, int redBits, int greenBits, int blueBits, int alphaBits, int depthBits, int stencilBits, bool doubleBuffered, bool sRGBFramebuffer, ContextPixelFormat pixelFormat, ContextSwapMethod swapMethod, int samples)
Parameters
Fields
AlphaBits
The number of bits used to represent the alpha channel.
Declaration
Field Value
BlueBits
The number of bits used to represent the blue channel.
Declaration
Field Value
DepthBits
The number of bits used to represent the depth buffer.
Declaration
Field Value
DoubleBuffered
If the backbuffer is double buffered or not.
Declaration
public bool DoubleBuffered
Field Value
GreenBits
The number of bits used to represent the green channel.
Declaration
Field Value
ID
The internal ID used to identify these context values.
Declaration
Field Value
PixelFormat
The pixel format of the backbuffer. Using floating point pixel formats allows for HDR display output.
Declaration
public ContextPixelFormat PixelFormat
Field Value
RedBits
The number of bits used to represent the red channel.
Declaration
Field Value
SRGBFramebuffer
If the backbuffer supports framebuffer sRGB conversion. Enabled using OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap) with OpenTK.Graphics.OpenGL.EnableCap.FramebufferSrgb.
Declaration
public bool SRGBFramebuffer
Field Value
Samples
The number of MSAA samples for the backbuffer.
Declaration
Field Value
StencilBits
The number of bits used to represent the stencil buffer.
Declaration
Field Value
Stereo
If the backbuffer has a left and right buffer.
Declaration
Field Value
SupportsFramebufferTransparency
Declaration
public bool SupportsFramebufferTransparency
Field Value
See Also
SwapMethod
The swap method to use for the backbuffer.
Declaration
public ContextSwapMethod SwapMethod
Field Value
Methods
DefaultValuesSelector(IReadOnlyList<ContextValues>, ContextValues, ILogger?)
Default context values selector. Prioritizes the requested values with a series of "relaxations" to find a close match.
The relaxations are done in the following order:
- If no exact match is found try find a format with a larger number of color, depth, or stencil bits.
- If SupportsFramebufferTransparency == false is requested, SupportsFramebufferTransparency == true formats will be accepted.
- If SRGBFramebuffer == false is requested, SRGBFramebuffer == true formats will be accepted.
- If SwapMethod == Undefined, any swap method will be accepted.
- If SupportsFramebufferTransparency == true, accept SupportsFramebufferTransparency == false formats.
- If SRGBFramebuffer == true, accept SRGBFramebuffer == false formats.
- Accept any PixelFormat.
- Decrement Samples by one at a time until 0 and see if any alternative sample counts are possible.
- Accept any SwapMethod.
- Allow one of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
- Allow two of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
- Relax all bit requirements.
- Relax double buffer requirements.
- If all relaxations fail, select the first option in the list.
Declaration
public static int DefaultValuesSelector(IReadOnlyList<ContextValues> options, ContextValues requested, ILogger? logger)
Parameters
Returns
Type |
Description |
int |
The index of the selected "best match" context values.
|
Equals(ContextValues)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(ContextValues other)
Parameters
Type |
Name |
Description |
ContextValues |
other |
An object to compare with this object.
|
Returns
Type |
Description |
bool |
true if the current object is equal to the other parameter; otherwise, false.
|
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object? obj)
Parameters
Type |
Name |
Description |
object |
obj |
The object to compare with the current instance.
|
Returns
Type |
Description |
bool |
true if obj and this instance are the same type and represent the same value; otherwise, false.
|
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type |
Description |
int |
A 32-bit signed integer that is the hash code for this instance.
|
Overrides
HasEqualColorBits(ContextValues, ContextValues)
Declaration
public static bool HasEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualDepthBits(ContextValues, ContextValues)
Declaration
public static bool HasEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualDoubleBuffer(ContextValues, ContextValues)
Declaration
public static bool HasEqualDoubleBuffer(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualFramebufferTransparencySupport(ContextValues, ContextValues)
Declaration
public static bool HasEqualFramebufferTransparencySupport(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualMSAA(ContextValues, ContextValues)
Declaration
public static bool HasEqualMSAA(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualPixelFormat(ContextValues, ContextValues)
Declaration
public static bool HasEqualPixelFormat(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualSRGB(ContextValues, ContextValues)
Declaration
public static bool HasEqualSRGB(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualStencilBits(ContextValues, ContextValues)
Declaration
public static bool HasEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualStereo(ContextValues, ContextValues)
Declaration
public static bool HasEqualStereo(ContextValues option, ContextValues requested)
Parameters
Returns
HasEqualSwapMethod(ContextValues, ContextValues)
Declaration
public static bool HasEqualSwapMethod(ContextValues option, ContextValues requested)
Parameters
Returns
HasGreaterOrEqualColorBits(ContextValues, ContextValues)
Declaration
public static bool HasGreaterOrEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasGreaterOrEqualDepthBits(ContextValues, ContextValues)
Declaration
public static bool HasGreaterOrEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasGreaterOrEqualStencilBits(ContextValues, ContextValues)
Declaration
public static bool HasGreaterOrEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasLessOrEqualColorBits(ContextValues, ContextValues)
Declaration
public static bool HasLessOrEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasLessOrEqualDepthBits(ContextValues, ContextValues)
Declaration
public static bool HasLessOrEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Returns
HasLessOrEqualStencilBits(ContextValues, ContextValues)
Declaration
public static bool HasLessOrEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Returns
IsEqualExcludingID(ContextValues, ContextValues)
Declaration
public static bool IsEqualExcludingID(ContextValues option, ContextValues requested)
Parameters
Returns
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override readonly string ToString()
Returns
Type |
Description |
string |
The fully qualified type name.
|
Overrides
Operators
operator ==(ContextValues, ContextValues)
Declaration
public static bool operator ==(ContextValues left, ContextValues right)
Parameters
Returns
operator !=(ContextValues, ContextValues)
Declaration
public static bool operator !=(ContextValues left, ContextValues right)
Parameters
Returns
Implements