The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.GameWindow Class Reference

The GameWindow class contains cross-platform methods to create and render on an OpenGL window, handle input and load resources. More...

+ Inheritance diagram for OpenTK.GameWindow:

Public Member Functions

 GameWindow ()
 Constructs a new GameWindow with sensible default attributes. More...
 
 GameWindow (int width, int height)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode, string title)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode, string title, GameWindowFlags options)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags)
 Constructs a new GameWindow with the specified attributes. More...
 
 GameWindow (int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)
 Constructs a new GameWindow with the specified attributes. More...
 
override void Dispose ()
 Disposes of the GameWindow, releasing all resources consumed by it. More...
 
virtual void Exit ()
 Closes the GameWindow. Equivalent to NativeWindow.Close method. More...
 
void MakeCurrent ()
 Makes the GraphicsContext current on the calling thread. More...
 
void Run ()
 Enters the game loop of the GameWindow using the maximum update rate. More...
 
void Run (double updateRate)
 Enters the game loop of the GameWindow using the specified update rate. maximum possible render frequency. More...
 
void Run (double updates_per_second, double frames_per_second)
 Enters the game loop of the GameWindow updating and rendering at the specified frequency. More...
 
void SwapBuffers ()
 Swaps the front and back buffer, presenting the rendered scene to the user. More...
 
- Public Member Functions inherited from OpenTK.NativeWindow
 NativeWindow ()
 Constructs a new NativeWindow with default attributes without enabling events. More...
 
 NativeWindow (int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
 Constructs a new centered NativeWindow with the specified attributes. More...
 
 NativeWindow (int x, int y, int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
 Constructs a new NativeWindow with the specified attributes. More...
 
void Close ()
 Closes the NativeWindow. More...
 
Point PointToClient (Point point)
 Transforms the specified point from screen to client coordinates. More...
 
Point PointToScreen (Point point)
 Transforms the specified point from client to screen coordinates. More...
 
void ProcessEvents ()
 Processes operating system events until the NativeWindow becomes idle. More...
 

Protected Member Functions

override void OnClosing (System.ComponentModel.CancelEventArgs e)
 Called when the NativeWindow is about to close. More...
 
virtual void OnLoad (EventArgs e)
 Called after an OpenGL context has been established, but before entering the main loop. More...
 
virtual void OnUnload (EventArgs e)
 Called after GameWindow.Exit was called, but before destroying the OpenGL context. More...
 
virtual void Dispose (bool manual)
 Override to add custom cleanup logic. More...
 
virtual void OnRenderFrame (FrameEventArgs e)
 Called when the frame is rendered. More...
 
virtual void OnUpdateFrame (FrameEventArgs e)
 Called when the frame is updated. More...
 
virtual void OnWindowInfoChanged (EventArgs e)
 Called when the WindowInfo for this GameWindow has changed. More...
 
override void OnResize (EventArgs e)
 Called when this window is resized. More...
 
- Protected Member Functions inherited from OpenTK.NativeWindow
void EnsureUndisposed ()
 Ensures that this NativeWindow has not been disposed. More...
 
virtual void OnClosed (EventArgs e)
 Called when the NativeWindow has closed. More...
 
virtual void OnClosing (CancelEventArgs e)
 Called when the NativeWindow is about to close. More...
 
virtual void OnDisposed (EventArgs e)
 Called when the NativeWindow is disposed. More...
 
virtual void OnFocusedChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Focused property of the NativeWindow has changed. More...
 
virtual void OnIconChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Icon property of the NativeWindow has changed. More...
 
virtual void OnKeyDown (KeyboardKeyEventArgs e)
 Occurs whenever a keybord key is pressed. More...
 
virtual void OnKeyPress (KeyPressEventArgs e)
 Called when a character is typed. More...
 
virtual void OnKeyUp (KeyboardKeyEventArgs e)
 Called when a keybord key is released. More...
 
virtual void OnMove (EventArgs e)
 Called when the NativeWindow is moved. More...
 
virtual void OnMouseEnter (EventArgs e)
 Called whenever the mouse cursor reenters the window Bounds. More...
 
virtual void OnMouseLeave (EventArgs e)
 Called whenever the mouse cursor leaves the window Bounds. More...
 
virtual void OnTitleChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Title property of the NativeWindow has changed. More...
 
virtual void OnVisibleChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Visible property of the NativeWindow has changed. More...
 
virtual void OnWindowBorderChanged (EventArgs e)
 Called when the WindowBorder of this NativeWindow has changed. More...
 
virtual void OnWindowStateChanged (EventArgs e)
 Called when the WindowState of this NativeWindow has changed. More...
 
void ProcessEvents (bool retainEvents)
 Processes operating system events until the NativeWindow becomes idle. More...
 

Properties

IGraphicsContext Context [get]
 Returns the opengl IGraphicsContext associated with the current GameWindow. More...
 
bool IsExiting [get]
 Gets a value indicating whether the shutdown sequence has been initiated for this window, by calling GameWindow.Exit() or hitting the 'close' button. If this property is true, it is no longer safe to use any OpenTK.Input or OpenTK.Graphics.OpenGL functions or properties. More...
 
IList< JoystickDeviceJoysticks [get]
 Gets a readonly IList containing all available OpenTK.Input.JoystickDevices. More...
 
KeyboardDevice Keyboard [get]
 Gets the primary Keyboard device, or null if no Keyboard exists. More...
 
MouseDevice Mouse [get]
 Gets the primary Mouse device, or null if no Mouse exists. More...
 
double RenderFrequency [get]
 Gets a double representing the actual frequency of RenderFrame events, in hertz (i.e. fps or frames per second). More...
 
double RenderPeriod [get]
 Gets a double representing the period of RenderFrame events, in seconds. More...
 
double RenderTime [get, set]
 Gets a double representing the time spent in the RenderFrame function, in seconds. More...
 
double TargetRenderFrequency [get, set]
 Gets or sets a double representing the target render frequency, in hertz. More...
 
double TargetRenderPeriod [get, set]
 Gets or sets a double representing the target render period, in seconds. More...
 
double TargetUpdateFrequency [get, set]
 Gets or sets a double representing the target update frequency, in hertz. More...
 
double TargetUpdatePeriod [get, set]
 Gets or sets a double representing the target update period, in seconds. More...
 
double UpdateFrequency [get]
 Gets a double representing the frequency of UpdateFrame events, in hertz. More...
 
double UpdatePeriod [get]
 Gets a double representing the period of UpdateFrame events, in seconds. More...
 
double UpdateTime [get]
 Gets a double representing the time spent in the UpdateFrame function, in seconds. More...
 
VSyncMode VSync [get, set]
 Gets or sets the VSyncMode. More...
 
override WindowState WindowState [get, set]
 Gets or states the state of the NativeWindow. More...
 
- Properties inherited from OpenTK.NativeWindow
Rectangle Bounds [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the external bounds of this window, in screen coordinates. External bounds include the title bar, borders and drawing area of the window. More...
 
Rectangle ClientRectangle [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the internal bounds of this window, in client coordinates. The internal bounds include the drawing area of the window, but exclude the titlebar and window borders. More...
 
Size ClientSize [get, set]
 Gets or sets a System.Drawing.Size structure that contains the internal size this window. More...
 
bool Exists [get]
 Gets a value indicating whether a render window exists. More...
 
bool Focused [get]
 Gets a System.Boolean that indicates whether this NativeWindow has input focus. More...
 
int Height [get, set]
 Gets or sets the external height of this window. More...
 
Icon Icon [get, set]
 Gets or sets the System.Drawing.Icon for this GameWindow. More...
 
IInputDriver InputDriver [get]
 This property is deprecated. More...
 
Point Location [get, set]
 Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop. More...
 
Size Size [get, set]
 Gets or sets a System.Drawing.Size structure that contains the external size of this window. More...
 
string Title [get, set]
 Gets or sets the NativeWindow title. More...
 
bool Visible [get, set]
 Gets or sets a System.Boolean that indicates whether this NativeWindow is visible. More...
 
int Width [get, set]
 Gets or sets the external width of this window. More...
 
WindowBorder WindowBorder [get, set]
 Gets or states the border of the NativeWindow. More...
 
IWindowInfo WindowInfo [get]
 Gets the OpenTK.Platform.IWindowInfo of this window. More...
 
virtual WindowState WindowState [get, set]
 Gets or states the state of the NativeWindow. More...
 
int X [get, set]
 Gets or sets the horizontal location of this window on the desktop. More...
 
int Y [get, set]
 Gets or sets the vertical location of this window on the desktop. More...
 
bool CursorVisible [get, set]
 Gets or sets a value indicating whether the mouse cursor is visible. More...
 
bool IsDisposed [get, set]
 Gets or sets a System.Boolean, which indicates whether this instance has been disposed. More...
 
- Properties inherited from OpenTK.INativeWindow
Icon Icon [get, set]
 Gets or sets the System.Drawing.Icon of the window. More...
 
string Title [get, set]
 Gets or sets the title of the window. More...
 
bool Focused [get]
 Gets a System.Boolean that indicates whether this window has input focus. More...
 
bool Visible [get, set]
 Gets or sets a System.Boolean that indicates whether the window is visible. More...
 
bool Exists [get]
 Gets a System.Boolean that indicates whether the window has been created and has not been destroyed. More...
 
IWindowInfo WindowInfo [get]
 Gets the OpenTK.Platform.IWindowInfo for this window. More...
 
WindowState WindowState [get, set]
 Gets or sets the OpenTK.WindowState for this window. More...
 
WindowBorder WindowBorder [get, set]
 Gets or sets the OpenTK.WindowBorder for this window. More...
 
Rectangle Bounds [get, set]
 Gets or sets a System.Drawing.Rectangle structure the contains the external bounds of this window, in screen coordinates. External bounds include the title bar, borders and drawing area of the window. More...
 
Point Location [get, set]
 Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop. More...
 
Size Size [get, set]
 Gets or sets a System.Drawing.Size structure that contains the external size of this window. More...
 
int X [get, set]
 Gets or sets the horizontal location of this window on the desktop. More...
 
int Y [get, set]
 Gets or sets the vertical location of this window on the desktop. More...
 
int Width [get, set]
 Gets or sets the external width of this window. More...
 
int Height [get, set]
 Gets or sets the external height of this window. More...
 
Rectangle ClientRectangle [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the internal bounds of this window, in client coordinates. The internal bounds include the drawing area of the window, but exclude the titlebar and window borders. More...
 
Size ClientSize [get, set]
 Gets or sets a System.Drawing.Size structure that contains the internal size this window. More...
 
OpenTK.Input.IInputDriver InputDriver [get]
 This property is deprecated and should not be used. More...
 
bool CursorVisible [get, set]
 Gets or sets a value, indicating whether the mouse cursor is visible. More...
 

Events

EventHandler< EventArgs > Load = delegate { }
 Occurs before the window is displayed for the first time. More...
 
EventHandler< FrameEventArgsRenderFrame = delegate { }
 Occurs when it is time to render a frame. More...
 
EventHandler< EventArgs > Unload = delegate { }
 Occurs before the window is destroyed. More...
 
EventHandler< FrameEventArgsUpdateFrame = delegate { }
 Occurs when it is time to update a frame. More...
 
- Events inherited from OpenTK.NativeWindow
EventHandler< EventArgs > Closed = delegate { }
 Occurs after the window has closed. More...
 
EventHandler< CancelEventArgs > Closing = delegate { }
 Occurs when the window is about to close. More...
 
EventHandler< EventArgs > Disposed = delegate { }
 Occurs when the window is disposed. More...
 
EventHandler< EventArgs > FocusedChanged = delegate { }
 Occurs when the Focused property of the window changes. More...
 
EventHandler< EventArgs > IconChanged = delegate { }
 Occurs when the Icon property of the window changes. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyDown = delegate { }
 Occurs whenever a keybord key is pressed. More...
 
EventHandler< KeyPressEventArgsKeyPress = delegate { }
 Occurs whenever a character is typed. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyUp = delegate { }
 Occurs whenever a keyboard key is released. More...
 
EventHandler< EventArgs > Move = delegate { }
 Occurs whenever the window is moved. More...
 
EventHandler< EventArgs > MouseEnter = delegate { }
 Occurs whenever the mouse cursor enters the window Bounds. More...
 
EventHandler< EventArgs > MouseLeave = delegate { }
 Occurs whenever the mouse cursor leaves the window Bounds. More...
 
EventHandler< EventArgs > Resize = delegate { }
 Occurs whenever the window is resized. More...
 
EventHandler< EventArgs > TitleChanged = delegate { }
 Occurs when the Title property of the window changes. More...
 
EventHandler< EventArgs > VisibleChanged = delegate { }
 Occurs when the Visible property of the window changes. More...
 
EventHandler< EventArgs > WindowBorderChanged = delegate { }
 Occurs when the WindowBorder property of the window changes. More...
 
EventHandler< EventArgs > WindowStateChanged = delegate { }
 Occurs when the WindowState property of the window changes. More...
 
- Events inherited from OpenTK.INativeWindow
EventHandler< EventArgs > Move
 Occurs whenever the window is moved. More...
 
EventHandler< EventArgs > Resize
 Occurs whenever the window is resized. More...
 
EventHandler< CancelEventArgs > Closing
 Occurs when the window is about to close. More...
 
EventHandler< EventArgs > Closed
 Occurs after the window has closed. More...
 
EventHandler< EventArgs > Disposed
 Occurs when the window is disposed. More...
 
EventHandler< EventArgs > IconChanged
 Occurs when the Icon property of the window changes. More...
 
EventHandler< EventArgs > TitleChanged
 Occurs when the Title property of the window changes. More...
 
EventHandler< EventArgs > VisibleChanged
 Occurs when the Visible property of the window changes. More...
 
EventHandler< EventArgs > FocusedChanged
 Occurs when the Focused property of the window changes. More...
 
EventHandler< EventArgs > WindowBorderChanged
 Occurs when the WindowBorder property of the window changes. More...
 
EventHandler< EventArgs > WindowStateChanged
 Occurs when the WindowState property of the window changes. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyDown
 Occurs whenever a keybord key is pressed. More...
 
EventHandler< KeyPressEventArgsKeyPress
 Occurs whenever a character is typed. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyUp
 Occurs whenever a keyboard key is released. More...
 
EventHandler< EventArgs > MouseLeave
 Occurs whenever the mouse cursor leaves the window Bounds. More...
 
EventHandler< EventArgs > MouseEnter
 Occurs whenever the mouse cursor enters the window Bounds. More...
 
- Events inherited from OpenTK.Platform.IGameWindow
EventHandler< EventArgs > Load
 Occurs before the window is displayed for the first time. More...
 
EventHandler< EventArgs > Unload
 Occurs before the window is destroyed. More...
 
EventHandler< FrameEventArgsUpdateFrame
 Occurs when it is time to update a frame. More...
 
EventHandler< FrameEventArgsRenderFrame
 Occurs when it is time to render a frame. More...
 

Detailed Description

The GameWindow class contains cross-platform methods to create and render on an OpenGL window, handle input and load resources.

GameWindow contains several events you can hook or override to add your custom logic:

  • OnLoad: Occurs after creating the OpenGL context, but before entering the main loop. Override to load resources.
  • OnUnload: Occurs after exiting the main loop, but before deleting the OpenGL context. Override to unload resources.
  • OnResize: Occurs whenever GameWindow is resized. You should update the OpenGL Viewport and Projection Matrix here.
  • OnUpdateFrame: Occurs at the specified logic update rate. Override to add your game logic.
  • OnRenderFrame: Occurs at the specified frame render rate. Override to add your rendering code.

Call the Run() method to start the application's main loop. Run(double, double) takes two parameters that specify the logic update rate, and the render update rate.

Constructor & Destructor Documentation

OpenTK.GameWindow.GameWindow ( )

Constructs a new GameWindow with sensible default attributes.

OpenTK.GameWindow.GameWindow ( int  width,
int  height 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode,
string  title 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
titleThe title of the GameWindow.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode,
string  title,
GameWindowFlags  options 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
titleThe title of the GameWindow.
optionsGameWindow options regarding window appearance and behavior.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode,
string  title,
GameWindowFlags  options,
DisplayDevice  device 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
titleThe title of the GameWindow.
optionsGameWindow options regarding window appearance and behavior.
deviceThe OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode,
string  title,
GameWindowFlags  options,
DisplayDevice  device,
int  major,
int  minor,
GraphicsContextFlags  flags 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
titleThe title of the GameWindow.
optionsGameWindow options regarding window appearance and behavior.
deviceThe OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
majorThe major version for the OpenGL GraphicsContext.
minorThe minor version for the OpenGL GraphicsContext.
flagsThe GraphicsContextFlags version for the OpenGL GraphicsContext.
OpenTK.GameWindow.GameWindow ( int  width,
int  height,
GraphicsMode  mode,
string  title,
GameWindowFlags  options,
DisplayDevice  device,
int  major,
int  minor,
GraphicsContextFlags  flags,
IGraphicsContext  sharedContext 
)

Constructs a new GameWindow with the specified attributes.

Parameters
widthThe width of the GameWindow in pixels.
heightThe height of the GameWindow in pixels.
modeThe OpenTK.Graphics.GraphicsMode of the GameWindow.
titleThe title of the GameWindow.
optionsGameWindow options regarding window appearance and behavior.
deviceThe OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
majorThe major version for the OpenGL GraphicsContext.
minorThe minor version for the OpenGL GraphicsContext.
flagsThe GraphicsContextFlags version for the OpenGL GraphicsContext.
sharedContextAn IGraphicsContext to share resources with.

Member Function Documentation

override void OpenTK.GameWindow.Dispose ( )
virtual

Disposes of the GameWindow, releasing all resources consumed by it.

Reimplemented from OpenTK.NativeWindow.

virtual void OpenTK.GameWindow.Dispose ( bool  manual)
protectedvirtual

Override to add custom cleanup logic.

Parameters
manualTrue, if this method was called by the application; false if this was called by the finalizer thread.
virtual void OpenTK.GameWindow.Exit ( )
virtual

Closes the GameWindow. Equivalent to NativeWindow.Close method.

Override if you are not using GameWindow.Run().

If you override this method, place a call to base.Exit(), to ensure proper OpenTK shutdown.

void OpenTK.GameWindow.MakeCurrent ( )

Makes the GraphicsContext current on the calling thread.

Implements OpenTK.Platform.IGameWindow.

override void OpenTK.GameWindow.OnClosing ( System.ComponentModel.CancelEventArgs  e)
protected

Called when the NativeWindow is about to close.

Parameters
eThe System.ComponentModel.CancelEventArgs for this event. Set e.Cancel to true in order to stop the GameWindow from closing.
virtual void OpenTK.GameWindow.OnLoad ( EventArgs  e)
protectedvirtual

Called after an OpenGL context has been established, but before entering the main loop.

Parameters
eNot used.
virtual void OpenTK.GameWindow.OnRenderFrame ( FrameEventArgs  e)
protectedvirtual

Called when the frame is rendered.

Parameters
eContains information necessary for frame rendering.

Subscribe to the RenderFrame event instead of overriding this method.

override void OpenTK.GameWindow.OnResize ( EventArgs  e)
protectedvirtual

Called when this window is resized.

Parameters
eNot used.

You will typically wish to update your viewport whenever the window is resized. See the OpenTK.Graphics.OpenGL.GL.Viewport(int, int, int, int) method.

Reimplemented from OpenTK.NativeWindow.

virtual void OpenTK.GameWindow.OnUnload ( EventArgs  e)
protectedvirtual

Called after GameWindow.Exit was called, but before destroying the OpenGL context.

Parameters
eNot used.
virtual void OpenTK.GameWindow.OnUpdateFrame ( FrameEventArgs  e)
protectedvirtual

Called when the frame is updated.

Parameters
eContains information necessary for frame updating.

Subscribe to the UpdateFrame event instead of overriding this method.

virtual void OpenTK.GameWindow.OnWindowInfoChanged ( EventArgs  e)
protectedvirtual

Called when the WindowInfo for this GameWindow has changed.

Parameters
eNot used.
void OpenTK.GameWindow.Run ( )

Enters the game loop of the GameWindow using the maximum update rate.

See Also
Run(double)

Implements OpenTK.Platform.IGameWindow.

void OpenTK.GameWindow.Run ( double  updateRate)

Enters the game loop of the GameWindow using the specified update rate. maximum possible render frequency.

Implements OpenTK.Platform.IGameWindow.

void OpenTK.GameWindow.Run ( double  updates_per_second,
double  frames_per_second 
)

Enters the game loop of the GameWindow updating and rendering at the specified frequency.

When overriding the default game loop you should call ProcessEvents() to ensure that your GameWindow responds to operating system events.

Once ProcessEvents() returns, it is time to call update and render the next frame.

Parameters
updates_per_secondThe frequency of UpdateFrame events.
frames_per_secondThe frequency of RenderFrame events.
void OpenTK.GameWindow.SwapBuffers ( )

Swaps the front and back buffer, presenting the rendered scene to the user.

Implements OpenTK.Platform.IGameWindow.

Property Documentation

IGraphicsContext OpenTK.GameWindow.Context
get

Returns the opengl IGraphicsContext associated with the current GameWindow.

bool OpenTK.GameWindow.IsExiting
get

Gets a value indicating whether the shutdown sequence has been initiated for this window, by calling GameWindow.Exit() or hitting the 'close' button. If this property is true, it is no longer safe to use any OpenTK.Input or OpenTK.Graphics.OpenGL functions or properties.

IList<JoystickDevice> OpenTK.GameWindow.Joysticks
get

Gets a readonly IList containing all available OpenTK.Input.JoystickDevices.

KeyboardDevice OpenTK.GameWindow.Keyboard
get

Gets the primary Keyboard device, or null if no Keyboard exists.

MouseDevice OpenTK.GameWindow.Mouse
get

Gets the primary Mouse device, or null if no Mouse exists.

double OpenTK.GameWindow.RenderFrequency
get

Gets a double representing the actual frequency of RenderFrame events, in hertz (i.e. fps or frames per second).

double OpenTK.GameWindow.RenderPeriod
get

Gets a double representing the period of RenderFrame events, in seconds.

double OpenTK.GameWindow.RenderTime
getset

Gets a double representing the time spent in the RenderFrame function, in seconds.

double OpenTK.GameWindow.TargetRenderFrequency
getset

Gets or sets a double representing the target render frequency, in hertz.

A value of 0.0 indicates that RenderFrame events are generated at the maximum possible frequency (i.e. only limited by the hardware's capabilities).

Values lower than 1.0Hz are clamped to 1.0Hz. Values higher than 200.0Hz are clamped to 200.0Hz.

double OpenTK.GameWindow.TargetRenderPeriod
getset

Gets or sets a double representing the target render period, in seconds.

A value of 0.0 indicates that RenderFrame events are generated at the maximum possible frequency (i.e. only limited by the hardware's capabilities).

Values lower than 0.005 seconds (200Hz) are clamped to 0.0. Values higher than 1.0 seconds (1Hz) are clamped to 1.0.

double OpenTK.GameWindow.TargetUpdateFrequency
getset

Gets or sets a double representing the target update frequency, in hertz.

A value of 0.0 indicates that UpdateFrame events are generated at the maximum possible frequency (i.e. only limited by the hardware's capabilities).

Values lower than 1.0Hz are clamped to 1.0Hz. Values higher than 200.0Hz are clamped to 200.0Hz.

double OpenTK.GameWindow.TargetUpdatePeriod
getset

Gets or sets a double representing the target update period, in seconds.

A value of 0.0 indicates that UpdateFrame events are generated at the maximum possible frequency (i.e. only limited by the hardware's capabilities).

Values lower than 0.005 seconds (200Hz) are clamped to 0.0. Values higher than 1.0 seconds (1Hz) are clamped to 1.0.

double OpenTK.GameWindow.UpdateFrequency
get

Gets a double representing the frequency of UpdateFrame events, in hertz.

double OpenTK.GameWindow.UpdatePeriod
get

Gets a double representing the period of UpdateFrame events, in seconds.

double OpenTK.GameWindow.UpdateTime
get

Gets a double representing the time spent in the UpdateFrame function, in seconds.

VSyncMode OpenTK.GameWindow.VSync
getset

Gets or sets the VSyncMode.

override WindowState OpenTK.GameWindow.WindowState
getset

Gets or states the state of the NativeWindow.

Event Documentation

EventHandler<EventArgs> OpenTK.GameWindow.Load = delegate { }

Occurs before the window is displayed for the first time.

EventHandler<FrameEventArgs> OpenTK.GameWindow.RenderFrame = delegate { }

Occurs when it is time to render a frame.

EventHandler<EventArgs> OpenTK.GameWindow.Unload = delegate { }

Occurs before the window is destroyed.

EventHandler<FrameEventArgs> OpenTK.GameWindow.UpdateFrame = delegate { }

Occurs when it is time to update a frame.