Programming Overview
This article describes ways of creating projects in Unigine.
The main purpose of the article is to provide insight into setting up the development environment and give the overview of programming. It contains links to other articles that help you to prepare the development environment, choose the language to programming and so on.
Languages
To create your own project with Unigine, you can use the following programming languages:
- UnigineScript.
- C++, by using C++ API.
- C#, by using C# API.
UnigineScript can be easily extended through the Unigine API. The Unigine engine enables exporting the C++ and C# code and vice versa. You can write some functionality by using the C++ or C# language, and export it to the UnigineScript. See usage examples articles of C++ API and C# API to know more.
Platforms
Unigine supports the following platforms:
- Windows (XP / Vista / 7 / 8+)
- Linux (kernel 2.6+)
- OS X (10.9+)
Both 32- and 64-bit systems are supported. The engine fully and efficiently uses multi-core CPU architecture.
With Unigine you can build applications for these platforms with a single codebase.
Read more about the Hardware Requirements.
Development Environments
You can use any of these PC platforms to write your Unigine-powered project:
- Windows
- Linux
- OS X
In addition to Unigine SDK, each platform requires specific software that you need to install in order to start coding. You can find requirements for each platform here:
Execution Sequence
Logic of the application is usually put into the world script. The world script file is automatically created with the new world (it has the .cpp extension). The initialization function of the world script (init()) is used to create objects and initialize all other necessary resources on the world load. A shutdown function (shutdown()) is called when the world is unloaded and is used to delete resources that were created during script execution to avoid memory leaks. For frame-by-frame update, world script has three functions:
- update() - is for rendering logic implementation (everything that is graphics-related)..
- flush() - is for physics, calculations and logic that should not be rendered.
- render() - is for correction of the behavior of the node after it has been updated.
Read this article to know where to put your logic code. Also, read the Execution Sequence article to know the detailed workflow of the Unigine engine.
Usage Examples
There are three sections with usage example samples:
The programming code is the same for all supported platforms, the difference is in compiling.
For all of these samples we create new projects by using Project Generator. Project Generator creates a new world with the World Light source and the plane mesh.