Show / Hide Table of Contents

Struct ContextValues

Implements
IEquatable<ContextValues>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Core.Platform
Assembly: OpenTK.Core.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
Type Name Description
ulong id
int redBits
int greenBits
int blueBits
int alphaBits
int depthBits
int stencilBits
bool doubleBuffered
bool sRGBFramebuffer
ContextPixelFormat pixelFormat
ContextSwapMethod swapMethod
int samples

Fields

AlphaBits

Declaration
public int AlphaBits
Field Value
Type Description
int

BlueBits

Declaration
public int BlueBits
Field Value
Type Description
int

DepthBits

Declaration
public int DepthBits
Field Value
Type Description
int

DoubleBuffered

Declaration
public bool DoubleBuffered
Field Value
Type Description
bool

GreenBits

Declaration
public int GreenBits
Field Value
Type Description
int

ID

Declaration
public ulong ID
Field Value
Type Description
ulong

PixelFormat

Declaration
public ContextPixelFormat PixelFormat
Field Value
Type Description
ContextPixelFormat

RedBits

Declaration
public int RedBits
Field Value
Type Description
int

SRGBFramebuffer

Declaration
public bool SRGBFramebuffer
Field Value
Type Description
bool

Samples

Declaration
public int Samples
Field Value
Type Description
int

StencilBits

Declaration
public int StencilBits
Field Value
Type Description
int

SwapMethod

Declaration
public ContextSwapMethod SwapMethod
Field Value
Type Description
ContextSwapMethod

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:

  1. If no exact match is found try find a format with a larger number of color, depth, or stencil bits.
  2. If SRGBFramebuffer == false is requested, SRGBFramebuffer == true formats will be accepted.
  3. If SwapMethod == Undefined, any swap method will be accepted.
  4. If SRGBFramebuffer == true, accept SRGBFramebuffer == false formats.
  5. Accept any PixelFormat.
  6. Decrement Samples by one at a time until 0 and see if any alternative sample counts are possible.
  7. Accept any SwapMethod.
  8. Allow one of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
  9. Allow two of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
  10. Relax all bit requirements.
  11. If all relaxations fail, select the first option in the list.
Declaration
public static int DefaultValuesSelector(IReadOnlyList<ContextValues> options, ContextValues requested, ILogger? logger)
Parameters
Type Name Description
IReadOnlyList<ContextValues> options

The possible context values.

ContextValues requested

The requested context values.

ILogger logger

A logger to use for logging.

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 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 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
ValueType.Equals(object)

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()

HasEqualColorBits(ContextValues, ContextValues)

Declaration
public static bool HasEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualDepthBits(ContextValues, ContextValues)

Declaration
public static bool HasEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualDoubleBuffer(ContextValues, ContextValues)

Declaration
public static bool HasEqualDoubleBuffer(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualMSAA(ContextValues, ContextValues)

Declaration
public static bool HasEqualMSAA(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualPixelFormat(ContextValues, ContextValues)

Declaration
public static bool HasEqualPixelFormat(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualSRGB(ContextValues, ContextValues)

Declaration
public static bool HasEqualSRGB(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualStencilBits(ContextValues, ContextValues)

Declaration
public static bool HasEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasEqualSwapMethod(ContextValues, ContextValues)

Declaration
public static bool HasEqualSwapMethod(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasGreaterOrEqualColorBits(ContextValues, ContextValues)

Declaration
public static bool HasGreaterOrEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasGreaterOrEqualDepthBits(ContextValues, ContextValues)

Declaration
public static bool HasGreaterOrEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasGreaterOrEqualStencilBits(ContextValues, ContextValues)

Declaration
public static bool HasGreaterOrEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasLessOrEqualColorBits(ContextValues, ContextValues)

Declaration
public static bool HasLessOrEqualColorBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasLessOrEqualDepthBits(ContextValues, ContextValues)

Declaration
public static bool HasLessOrEqualDepthBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

HasLessOrEqualStencilBits(ContextValues, ContextValues)

Declaration
public static bool HasLessOrEqualStencilBits(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

IsEqualExcludingID(ContextValues, ContextValues)

Declaration
public static bool IsEqualExcludingID(ContextValues option, ContextValues requested)
Parameters
Type Name Description
ContextValues option
ContextValues requested
Returns
Type Description
bool

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
ValueType.ToString()

Operators

operator ==(ContextValues, ContextValues)

Declaration
public static bool operator ==(ContextValues left, ContextValues right)
Parameters
Type Name Description
ContextValues left
ContextValues right
Returns
Type Description
bool

operator !=(ContextValues, ContextValues)

Declaration
public static bool operator !=(ContextValues left, ContextValues right)
Parameters
Type Name Description
ContextValues left
ContextValues right
Returns
Type Description
bool

Implements

IEquatable<T>
In this article
Back to top Generated by DocFX