TGPGuiLib : Cross Platform User Interface

Japanese translation
Japanese translation

Updated 21/10/03
Check out the What's New page for details

End Users Developers Contact

The TGPGuiLib™ provides cross platform user interface support for Terragen™ plugins. In case you have just wandered in, Terragen is an excellent near photorealistic landscape generator/renderer. You can find the website here. The TGPGuiLib allows plugin developers to write Terragen plugins that have user interfaces which can run with minimal effort on both the Windows and Macintosh versions of Terragen. It also provides developers with what is hopefully a straightforward way to create user interfaces, and allows close integration with Terragen.

Here's an example of a plugin interface which uses the TGPGuiLib :

Mac example Windows example

Click images to see full size versions in new window

The picture on the left shows the plugin running on the Mac OS X, and the picture on the right shows the plugin running on Windows XP. Both these windows use exactly the same source code. This plugin is from the WaterWorks pack, which you can find out more about here.

The TGPGuiLib for End Users

It's very easy to use the TGPGuiLib. At the moment Mac users don't need to do anything, as the TGPGuiLib is included inside Terragen Mac.

Windows users need to download the installer, linked to below. Once downloaded, double click the installer and follow it's instructions. If your copy of Terragen is not installed in the default location ( which is "C:\Program Files\Terragen" ) then you will need to browse to the folder Terragen is installed in when prompted. The installer will install the following items, all of which must be in the same folder as your Terragen application :

Plugins that use the TGPGuiLib will find it automatically. The TGPGuiLib doesn't do anything itself, it just provides services for plugins.

Windows users - please note that if you cannot see the TGPGuiLib.DLL file after unzipping the download, then Windows is hiding it from you. It is actually there. Windows hides certain types of files from you by default, and DLL files are one of those types. For instructions on turning on the display of hidden files in the version of Windows you use, please search the Windows help for something like "show all files".

The TGPGuiLib is free for everyone to use, although that is not to say it's public domain. I reserve all rights to it.


Currently only the Windows version of the TGPGuiLib is available for download. The Mac version is included inside Terragen Mac.

TGPGuiLib for Windows
Version 1.2.7 Released 21/10/03.

Important : The TGPGuiLib now requires OpenGL. This does not mean that you have to have a 3D card in your machine, just that you need OpenGL installed on your system. To the best of my knowledge, OpenGL has been installed with Windows since Windows 98. If you have an older version of Windows, you will need to visit the Microsoft website to find the installer. If I can find a link to this myself I will add it here.

If you would like to be notified of when newer versions of the TGPGuiLib are released, then you can click here to subscribe to an announcement mailing list. This is a low volume list where the only messages posted will be announcements of new versions of the TGPGuiLib.

Known Issues

Here's a list of the current issues or bugs effecting the TGPGuiLib ( these only effect the Windows version ) :

Here's a list of some plugins that use the TGPGuiLib. If you'd like to add your plugin to the list, please email me.

Available for Mac/Windows
WaterWorks is a collection of water effects plugins. There are a number of plugins in the pack, from a surf effect plugin to a lava plugin to an ice shelf effect plugin.

For Export Only
Available for Mac/Windows
For Export Only is a set of terrain export plugins. It exports Windows BMP, Autodesk DXF, Wavefront OBJ and RenderMan RIB files. A 3DS Max and Electric Image FACT exporter will be added in upcoming releases.

Available for Mac/Windows
Solaris is a Lighting Accessory plugin which lets you set the position of the Sun according to a location on the Earth, given in latitude and longitude, a date and the time of day.

The TGPGuiLib for Developers

The TGPGuiLib currently supports a good basic range of UI functionality. It supports multiple modal windows and a range of controls. It also supports Open and Save file dialogs, alerts/message boxes, a colour picker and a progress dialog for lengthy operations. As of v1.2, the TGPGuiLib also supports graphics using OpenGL, with both full window and seperate graphic area support, as well as timer functions. There are a range of utility functions, including extensive byte swapping functions to allow you to easily read and write cross platform data. The TGPGuiLib also has a set of functions which make saving and loading settings to Terragen world files much more straightforward.

As of v1.2.6, the TGPGuiLib adds support for loading XML based GUI description files. These files can be generated easily from interface builders ( such as Visual Basic on Windows or REALbasic on the Mac ) and help to greatly simplify the process of creating plugin GUIs. Along with this, a structured folder resource system has been added. This allows plugins to automatically load resource files appropriate for each supported platform ( Mac OS 9, Mac OS X, Windows ). This process is handled by the TGPGuiLib, plugin developers simply need to put the appropriate files in the appropriate places. Future versions of the TGPGuiLib will add language support to the resource system which, along with Unicode support, will make it possible to have localised plugins.

v1.2.7 adds a stack based GUI layout system which automatically lays out UI according to specific rules for each platform. This a very quick way to create plugin interfaces, especially suited to certain kinds of plugins.

The TGPGuiLib is a shared library/DLL with a C interface. At present the TGPGuiLib is not widely available as it still needs to be documented, and besides, the Terragen PDK is not widely available yet either.

A Developer page with more about the UI elements the TGPGuiLib supports, as well as details on future additions and enhancements, is forthcoming. Watch this space.


If you have any questions, bug reports, complaints, salutations and the like, you can contact me, Jo Meder, via email at

Many thanks to Yoshiki Shimakawa for doing a Japanese translation of this site, which you can see here.

In case you were wondering, TGPGuiLib stands for Terragen Plugin Graphical User Interface Library.

This site and the TGPGuiLib are copyright © Jo Meder 2003.
TGPGuiLib is a trademark of Jo Meder. Terragen is a trademark of Planetside Software.
All of other trademarks are the property of their respective owners.