Table of Contents

Class ShaderWindow

Namespace
Bonsai.Shaders
Assembly
Bonsai.Shaders.dll

Creates and renders a window using the specified resources and a programmable shader pipeline.

public class ShaderWindow : GameWindow, IGameWindow, INativeWindow, IDisposable
Inheritance
ShaderWindow
Implements
Inherited Members
GameWindow.MakeCurrent()
GameWindow.Run()
GameWindow.SwapBuffers()
GameWindow.RenderFrequency
GameWindow.RenderPeriod
GameWindow.RenderTime
GameWindow.TargetRenderFrequency
GameWindow.TargetRenderPeriod
GameWindow.TargetUpdateFrequency
GameWindow.TargetUpdatePeriod
GameWindow.UpdateFrequency
GameWindow.UpdatePeriod
GameWindow.UpdateTime
GameWindow.VSync
GameWindow.WindowState
GameWindow.Load
GameWindow.RenderFrame
GameWindow.Unload
GameWindow.UpdateFrame
GameWindow.OnUpdateThreadStarted

Constructors

ShaderWindow(ShaderWindowSettings)

Initializes a new instance of the ShaderWindow class using the specified window configuration settings.

public ShaderWindow(ShaderWindowSettings configuration)

Parameters

configuration ShaderWindowSettings

The configuration settings used to initialize the shader window.

Properties

ClearColor

Gets or sets the color used to clear the framebuffer before rendering.

public Color ClearColor { get; set; }

Property Value

Color

ClientSize

Gets or sets the size of the OpenGL surface in window coordinates. The coordinates are specified in device-dependent pixels.

public Size ClientSize { get; set; }

Property Value

Size

Height

Gets or sets the height of the OpenGL surface in window coordinates. The coordinates are specified in device-dependent pixels.

public int Height { get; set; }

Property Value

int

ResourceManager

Gets the resource manager used to load and release sets of render resources to the shader window.

public ResourceManager ResourceManager { get; }

Property Value

ResourceManager

Scissor

Gets or sets the active scissor box, in normalized coordinates. Any fragments falling outside the scissor box will be discarded.

public RectangleF Scissor { get; set; }

Property Value

RectangleF

Shaders

Gets the collection of shaders specifying the active render pipeline.

public IEnumerable<Shader> Shaders { get; }

Property Value

IEnumerable<Shader>

Viewport

Gets or sets the active viewport for rendering, in normalized coordinates.

public RectangleF Viewport { get; set; }

Property Value

RectangleF

Width

Gets or sets the width of the OpenGL surface in window coordinates. The coordinates are specified in device-dependent pixels.

public int Width { get; set; }

Property Value

int

Methods

OnClosed(EventArgs)

Called when the NativeWindow has closed.

protected override void OnClosed(EventArgs e)

Parameters

e EventArgs

Not used.

OnKeyDown(KeyboardKeyEventArgs)

Occurs whenever a keyboard key is pressed.

protected override void OnKeyDown(KeyboardKeyEventArgs e)

Parameters

e KeyboardKeyEventArgs

OnLoad(EventArgs)

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

protected override void OnLoad(EventArgs e)

Parameters

e EventArgs

Not used.

OnRenderFrame(FrameEventArgs)

Called when the frame is rendered.

protected override void OnRenderFrame(FrameEventArgs e)

Parameters

e FrameEventArgs

Contains information necessary for frame rendering.

Remarks

Subscribe to the OpenTK.GameWindow.RenderFrame event instead of overriding this method.

OnResize(EventArgs)

Called when this window is resized.

protected override void OnResize(EventArgs e)

Parameters

e EventArgs

Not used.

Remarks

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

OnUnload(EventArgs)

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

protected override void OnUnload(EventArgs e)

Parameters

e EventArgs

Not used.

OnUpdateFrame(FrameEventArgs)

Called when the frame is updated.

protected override void OnUpdateFrame(FrameEventArgs e)

Parameters

e FrameEventArgs

Contains information necessary for frame updating.

Remarks

Subscribe to the OpenTK.GameWindow.UpdateFrame event instead of overriding this method.

Update(Action)

Queues a render command or state update.

public void Update(Action action)

Parameters

action Action

The action that will execute when the next frame is rendered.