Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

Application with OpenGL via OpenTK Library

This article describes the sample located in the <UnigineSDK>/source/csharp/samples/App/GLTKAppForm/ folder.

The sample demonstrates how to embed Unigine into a Windows Forms application:

  • Create a Windows Forms application and embed Unigine into it.
  • Initialize OpenGL by using OpenTK library.
Notice
The sample can be run on Windows only.

Running Sample

To run the sample, you should do the following:

  1. Prepare the development environment:
    Notice
    Microsoft .NET Framework 4 or higher is required.
    Notice
    OpenTK library will be installed automatically when you install Unigine SDK.
  2. Open the Visual C# main_x86.csproj (or main_x64.csproj) project file located in the <UnigineSDK>/source/csharp/samples/App/GLTKAppForm/ folder.
  3. Click the button on the toolbar (or DEBUG -> Start Debugging) to start the project.

    Windows Form Application will open.

Description of C# classes

This sample contains 4 classes:

  • AppForm - inherits the Unigine.App class. In this class the doUpdate(), doRender() and doSwap() functions are overridden and call the update(), render() and swap() functions respectively.
  • AppFormControl - inherits the System.Windows.Forms.Form class. This class implements all the necessary events, which will be performed when user interacts with the application.
  • GLTKAppForm - inherits the AppForm class and initializes the graphics OpenGL API in the Windows Forms Application via the OpenTK library.
  • UnigineApp - defines the entry point of the program. C# Wrapper and Engine are initialized here.
Notice
AppForm, AppFormControl, GLTKAppForm are defined in the Unigine namespace.

See Also

Last update: 2017-07-03