C# 클래스 OpenTK.GameWindow

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.
상속: NativeWindow, IGameWindow, IDisposable
파일 보기 프로젝트 열기: andykorth/opentk 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void

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

Exit ( ) : void

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.

GameWindow ( ) : System

Constructs a new GameWindow with sensible default attributes.

GameWindow ( int width, int height ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags ) : System

Constructs a new GameWindow with the specified attributes.

GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext ) : System

Constructs a new GameWindow with the specified attributes.

MakeCurrent ( ) : void

Makes the GraphicsContext current on the calling thread.

Run ( ) : void

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

Run ( double updateRate ) : void

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

Run ( double updates_per_second, double frames_per_second ) : void

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.

SwapBuffers ( ) : void

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

보호된 메소드들

메소드 설명
Dispose ( bool manual ) : void

Override to add custom cleanup logic.

OnClosing ( System e ) : void

Called when the NativeWindow is about to close.

OnLoad ( EventArgs e ) : void

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

OnRenderFrame ( FrameEventArgs e ) : void

Called when the frame is rendered.

Subscribe to the RenderFrame event instead of overriding this method.

OnResize ( EventArgs e ) : void

Called when this window is resized.

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.

OnUnload ( EventArgs e ) : void

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

OnUpdateFrame ( FrameEventArgs e ) : void

Called when the frame is updated.

Subscribe to the UpdateFrame event instead of overriding this method.

OnWindowInfoChanged ( EventArgs e ) : void

Called when the WindowInfo for this GameWindow has changed.

비공개 메소드들

메소드 설명
DispatchUpdateAndRenderFrame ( object sender, EventArgs e ) : void
OnLoadInternal ( EventArgs e ) : void
OnRenderFrameInternal ( FrameEventArgs e ) : void
OnUnloadInternal ( EventArgs e ) : void
OnUpdateFrameInternal ( FrameEventArgs e ) : void
OnWindowInfoChangedInternal ( EventArgs e ) : void
RaiseRenderFrame ( Stopwatch render_watch, double &next_render, FrameEventArgs render_args ) : void
RaiseUpdateFrame ( Stopwatch update_watch, double &next_update, FrameEventArgs update_args ) : void

메소드 상세

Dispose() 공개 메소드

Disposes of the GameWindow, releasing all resources consumed by it.
public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Override to add custom cleanup logic.
protected Dispose ( bool manual ) : void
manual bool True, if this method was called by the application; false if this was called by the finalizer thread.
리턴 void

Exit() 공개 메소드

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.

public Exit ( ) : void
리턴 void

GameWindow() 공개 메소드

Constructs a new GameWindow with sensible default attributes.
public GameWindow ( ) : System
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
title string The title of the GameWindow.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
title string The title of the GameWindow.
options GameWindowFlags GameWindow options regarding window appearance and behavior.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
title string The title of the GameWindow.
options GameWindowFlags GameWindow options regarding window appearance and behavior.
device DisplayDevice The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
title string The title of the GameWindow.
options GameWindowFlags GameWindow options regarding window appearance and behavior.
device DisplayDevice The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
major int The major version for the OpenGL GraphicsContext.
minor int The minor version for the OpenGL GraphicsContext.
flags GraphicsContextFlags The GraphicsContextFlags version for the OpenGL GraphicsContext.
리턴 System

GameWindow() 공개 메소드

Constructs a new GameWindow with the specified attributes.
public GameWindow ( int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext ) : System
width int The width of the GameWindow in pixels.
height int The height of the GameWindow in pixels.
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GameWindow.
title string The title of the GameWindow.
options GameWindowFlags GameWindow options regarding window appearance and behavior.
device DisplayDevice The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
major int The major version for the OpenGL GraphicsContext.
minor int The minor version for the OpenGL GraphicsContext.
flags GraphicsContextFlags The GraphicsContextFlags version for the OpenGL GraphicsContext.
sharedContext IGraphicsContext An IGraphicsContext to share resources with.
리턴 System

MakeCurrent() 공개 메소드

Makes the GraphicsContext current on the calling thread.
public MakeCurrent ( ) : void
리턴 void

OnClosing() 보호된 메소드

Called when the NativeWindow is about to close.
protected OnClosing ( System e ) : void
e System /// The for this event. /// Set e.Cancel to true in order to stop the GameWindow from closing.
리턴 void

OnLoad() 보호된 메소드

Called after an OpenGL context has been established, but before entering the main loop.
protected OnLoad ( EventArgs e ) : void
e System.EventArgs Not used.
리턴 void

OnRenderFrame() 보호된 메소드

Called when the frame is rendered.
Subscribe to the RenderFrame event instead of overriding this method.
protected OnRenderFrame ( FrameEventArgs e ) : void
e FrameEventArgs Contains information necessary for frame rendering.
리턴 void

OnResize() 보호된 메소드

Called when this window is resized.
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.
protected OnResize ( EventArgs e ) : void
e System.EventArgs Not used.
리턴 void

OnUnload() 보호된 메소드

Called after GameWindow.Exit was called, but before destroying the OpenGL context.
protected OnUnload ( EventArgs e ) : void
e System.EventArgs Not used.
리턴 void

OnUpdateFrame() 보호된 메소드

Called when the frame is updated.
Subscribe to the UpdateFrame event instead of overriding this method.
protected OnUpdateFrame ( FrameEventArgs e ) : void
e FrameEventArgs Contains information necessary for frame updating.
리턴 void

OnWindowInfoChanged() 보호된 메소드

Called when the WindowInfo for this GameWindow has changed.
protected OnWindowInfoChanged ( EventArgs e ) : void
e System.EventArgs Not used.
리턴 void

Run() 공개 메소드

Enters the game loop of the GameWindow using the maximum update rate.
public Run ( ) : void
리턴 void

Run() 공개 메소드

Enters the game loop of the GameWindow using the specified update rate. maximum possible render frequency.
public Run ( double updateRate ) : void
updateRate double
리턴 void

Run() 공개 메소드

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.

public Run ( double updates_per_second, double frames_per_second ) : void
updates_per_second double The frequency of UpdateFrame events.
frames_per_second double The frequency of RenderFrame events.
리턴 void

SwapBuffers() 공개 메소드

Swaps the front and back buffer, presenting the rendered scene to the user.
public SwapBuffers ( ) : void
리턴 void