Show / Hide Table of Contents

Class NativeWindowSettings

NativeWindow related settings.

Inheritance
object
NativeWindowSettings
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenTK.Windowing.Desktop
Assembly: OpenTK.Windowing.Desktop.dll
Syntax
public class NativeWindowSettings

Constructors

NativeWindowSettings()

Initializes a new instance of the NativeWindowSettings class.

Declaration
public NativeWindowSettings()

Fields

Default

Gets the default settings for a NativeWindow.

Declaration
public static readonly NativeWindowSettings Default
Field Value
Type Description
NativeWindowSettings

Properties

API

Gets or sets a value representing the current graphics API.

Declaration
public ContextAPI API { get; set; }
Property Value
Type Description
ContextAPI
Remarks

If this is changed, you'll have to modify the API version as well, as the versioning of OpenGL and OpenGL ES do not match.

APIVersion

Gets or sets a value representing the current version of the graphics API.

Declaration
public Version APIVersion { get; set; }
Property Value
Type Description
Version
Remarks

OpenGL 3.3 is selected by default, and runs on almost any hardware made within the last ten years. This will run on Windows, Mac OS, and Linux.

OpenGL 4.1 is suggested for modern apps meant to run on more modern hardware. This will run on Windows, Mac OS, and Linux.

OpenGL 4.6 is suggested for modern apps that only intend to run on Windows and Linux; Mac OS doesn't support it.

Note that if you choose an API other than base OpenGL, this will need to be updated accordingly, as the versioning of OpenGL and OpenGL ES do not match.

AlphaBits

Gets or sets a value indicating the number of alpha bits used for OpenGL context creation.

Declaration
public int? AlphaBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 8.

AspectRatio

Gets or sets the aspect ratio the window is locked to until changed.

Declaration
public (int numerator, int denominator)? AspectRatio { get; set; }
Property Value
Type Description
(int numerator, int denominator)?
Remarks

Set to null to disable aspect ratio locking. If you set size limits and an aspect ratio that conflict, the results are undefined.

AutoIconify

Gets or sets a value indicating whether the application window will be minimized if the focus changes while the window is in fullscreen mode. The default value is true.

Declaration
public bool AutoIconify { get; set; }
Property Value
Type Description
bool

AutoLoadBindings

Gets or sets a value indicating whether or not OpenGL bindings should be automatically loaded when the window is created.

Declaration
public bool AutoLoadBindings { get; set; }
Property Value
Type Description
bool

BlueBits

Gets or sets a value indicating the number of blue bits used for OpenGL context creation.

Declaration
public int? BlueBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 8.

ClientSize

Gets or sets the initial size of the contents of the window.

Declaration
public Vector2i ClientSize { get; set; }
Property Value
Type Description
Vector2i

CurrentMonitor

Gets or sets the monitor to open the new window on.

Declaration
public MonitorHandle CurrentMonitor { get; set; }
Property Value
Type Description
MonitorHandle

DepthBits

Gets or sets a value indicating the number of depth bits used for OpenGL context creation.

Declaration
public int? DepthBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 24.

Flags

Gets or sets a value representing the current graphics profile flags. Default value is ForwardCompatible to work out of the box on macos.

Declaration
public ContextFlags Flags { get; set; }
Property Value
Type Description
ContextFlags

GreenBits

Gets or sets a value indicating the number of green bits used for OpenGL context creation.

Declaration
public int? GreenBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 8.

Icon

Gets or sets the current WindowIcon for this window.

Declaration
public WindowIcon Icon { get; set; }
Property Value
Type Description
WindowIcon
Remarks

This does nothing on macOS; on that platform, the icon is determined by the application bundle.

IsEventDriven

Gets or sets a value indicating whether or not this window is event-driven. An event-driven window will wait for events before updating/rendering. It is useful for non-game applications, where the program only needs to do any processing after the user inputs something.

Declaration
public bool IsEventDriven { get; set; }
Property Value
Type Description
bool

IsFullscreen

Gets or sets a value indicating whether the window should start fullscreen.

Declaration
[Obsolete("Use WindowState instead.", true)]
public bool IsFullscreen { get; set; }
Property Value
Type Description
bool

Location

Gets or sets the location to open the new window on.

Declaration
public Vector2i? Location { get; set; }
Property Value
Type Description
Vector2i?
Remarks

If null, the window will be placed by the OS.

MaximumClientSize

Gets or sets the maximum size of the contents of the window.

Declaration
public Vector2i? MaximumClientSize { get; set; }
Property Value
Type Description
Vector2i?
Remarks

Set to null to remove the minimum size constraint. If you set size limits and an aspect ratio that conflict, the results are undefined.

MaximumSize

Gets or sets the maximum size of the contents of the window.

Declaration
[Obsolete("Use the MaximumClientSize property to get or set the minimum size of the contents of the window.")]
public Vector2i? MaximumSize { get; set; }
Property Value
Type Description
Vector2i?
Remarks

Set to null to remove the minimum size constraint. If you set size limits and an aspect ratio that conflict, the results are undefined.

MinimumClientSize

Gets or sets the minimum size of the contents of the window.

Declaration
public Vector2i? MinimumClientSize { get; set; }
Property Value
Type Description
Vector2i?
Remarks

Set to null to remove the minimum size constraint. If you set size limits and an aspect ratio that conflict, the results are undefined.

MinimumSize

Gets or sets the minimum size of the contents of the window.

Declaration
[Obsolete("Use the MinimumClientSize property to get or set the minimum size of the contents of the window.")]
public Vector2i? MinimumSize { get; set; }
Property Value
Type Description
Vector2i?
Remarks

Set to null to remove the minimum size constraint. If you set size limits and an aspect ratio that conflict, the results are undefined.

NumberOfSamples

Gets or sets a value indicating the number of samples that should be used.

Declaration
public int NumberOfSamples { get; set; }
Property Value
Type Description
int
Remarks

0 indicates that no multisampling should be used; otherwise multisampling is used if available. The actual number of samples is the closest matching the given number that is supported.

Profile

Gets or sets a value representing the current graphics API profile.

Declaration
public ContextProfile Profile { get; set; }
Property Value
Type Description
ContextProfile
Remarks

This only has an effect on OpenGL 3.2 and higher. On older versions, this setting does nothing.

RedBits

Gets or sets a value indicating the number of red bits used for OpenGL context creation.

Declaration
public int? RedBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 8.

SharedContext

Gets or sets the context to share.

Declaration
public IGLFWGraphicsContext SharedContext { get; set; }
Property Value
Type Description
IGLFWGraphicsContext

Size

Gets or sets the initial size of the contents of the window.

Declaration
[Obsolete("Use the ClientSize property to get or set the initial size of the contents of the window.")]
public Vector2i Size { get; set; }
Property Value
Type Description
Vector2i

SrgbCapable

Gets or sets a value indicating whether the backbuffer should be sRGB capable.

Declaration
public bool SrgbCapable { get; set; }
Property Value
Type Description
bool

StartFocused

Gets or sets a value indicating whether this window should start with focus when created.

Declaration
public bool StartFocused { get; set; }
Property Value
Type Description
bool

StartVisible

Gets or sets a value indicating whether the new window should start visible.

Declaration
public bool StartVisible { get; set; }
Property Value
Type Description
bool

StencilBits

Gets or sets a value indicating the number of stencil bits used for OpenGL context creation.

Declaration
public int? StencilBits { get; set; }
Property Value
Type Description
int?
Remarks

Default value is 8.

Title

Gets or sets the title of the new window.

Declaration
public string Title { get; set; }
Property Value
Type Description
string

TransparentFramebuffer

Gets or sets a value indicating whether the framebuffer should be transparent or not. null and false does not result in a transparent framebuffer while true will result in a transparent framebuffer.

Declaration
public bool? TransparentFramebuffer { get; set; }
Property Value
Type Description
bool?

Vsync

Gets or sets a value indicating the vsync mode to use. A pure NativeWindow supports Off and On. GameWindow adds support for Adaptive, if you are not using GameWindow you will have to handle adaptive vsync yourself.

Declaration
public VSyncMode Vsync { get; set; }
Property Value
Type Description
VSyncMode

WindowBorder

Gets or sets the initial value for WindowBorder on the new window.

Declaration
public WindowBorder WindowBorder { get; set; }
Property Value
Type Description
WindowBorder

WindowState

Gets or sets the initial value for WindowState on the new window. This setting is ignored if StartVisible = false.

Declaration
public WindowState WindowState { get; set; }
Property Value
Type Description
WindowState
In this article
Back to top Generated by DocFX