Show / Hide Table of Contents

Struct ContextValues

Values describing the full specification of a OpenGL context's backbuffer.

Implements
IEquatable<ContextValues>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Platform
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
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

The number of bits used to represent the alpha channel.

Declaration
public int AlphaBits
Field Value
Type Description
int

BlueBits

The number of bits used to represent the blue channel.

Declaration
public int BlueBits
Field Value
Type Description
int

DepthBits

The number of bits used to represent the depth buffer.

Declaration
public int DepthBits
Field Value
Type Description
int

DoubleBuffered

If the backbuffer is double buffered or not.

Declaration
public bool DoubleBuffered
Field Value
Type Description
bool

GreenBits

The number of bits used to represent the green channel.

Declaration
public int GreenBits
Field Value
Type Description
int

ID

The internal ID used to identify these context values.

Declaration
public ulong ID
Field Value
Type Description
ulong

PixelFormat

The pixel format of the backbuffer. Using floating point pixel formats allows for HDR display output.

Declaration
public ContextPixelFormat PixelFormat
Field Value
Type Description
ContextPixelFormat

RedBits

The number of bits used to represent the red channel.

Declaration
public int RedBits
Field Value
Type Description
int

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
Type Description
bool

Samples

The number of MSAA samples for the backbuffer.

Declaration
public int Samples
Field Value
Type Description
int

StencilBits

The number of bits used to represent the stencil buffer.

Declaration
public int StencilBits
Field Value
Type Description
int

Stereo

If the backbuffer has a left and right buffer.

Declaration
public bool Stereo
Field Value
Type Description
bool

SupportsFramebufferTransparency

If this context configuration supports TransparentFramebuffer.

Declaration
public bool SupportsFramebufferTransparency
Field Value
Type Description
bool
See Also
TransparentFramebuffer
SetTransparencyMode(WindowHandle, WindowTransparencyMode, float)
GetTransparencyMode(WindowHandle, out float)

SwapMethod

The swap method to use for the backbuffer.

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 SupportsFramebufferTransparency == false is requested, SupportsFramebufferTransparency == true formats will be accepted.
  3. If SRGBFramebuffer == false is requested, SRGBFramebuffer == true formats will be accepted.
  4. If SwapMethod == Undefined, any swap method will be accepted.
  5. If SupportsFramebufferTransparency == true, accept SupportsFramebufferTransparency == false formats.
  6. If SRGBFramebuffer == true, accept SRGBFramebuffer == false formats.
  7. Accept any PixelFormat.
  8. Decrement Samples by one at a time until 0 and see if any alternative sample counts are possible.
  9. Accept any SwapMethod.
  10. Allow one of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
  11. Allow two of color bits (RedBits, GreenBits, BlueBits, and AlphaBits), DepthBits, or StencilBits to be lower than requested.
  12. Relax all bit requirements.
  13. Relax double buffer requirements.
  14. 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 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
ValueType.Equals(object)

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
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

HasEqualFramebufferTransparencySupport(ContextValues, ContextValues)

Declaration
public static bool HasEqualFramebufferTransparencySupport(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

HasEqualStereo(ContextValues, ContextValues)

Declaration
public static bool HasEqualStereo(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