Introduction

This sample explains how to use the GameWindow class. It creates a new GameWindow, hooks the necessary events and renders a simple triangle on screen.

Controls

Move or resize the window with your mouse.
Press F11 to toggle between fullscreen and windowed modes.
Press Esc to exit.

Implementation

This samples subclasses GameWindow and overrides its Load, Unload, Resize, UpdateFrame and RenderFrame events.

1. The Load event is responsible for setting up persistent OpenGL state (e.g. background color) and loading the necessary resources (e.g. textures). This sample is very simple, so we don't need to load any resouces.

2. The Unload event is responsible for cleaning up the resources we loaded. This sample is very simple, so we don't need to unload any resouces.

3. The Resize event is responsible for refreshing the viewport whenever the user resizes the window.

4. The UpdateFrame event is responsible for updating the game state.

5. The RenderFrame event is responsible for rendering all game objects.