Blender  V3.3
GHOST

Introduction

GHOST is yet another acronym. It stands for "Generic Handy Operating System Toolkit". It has been created to replace the OpenGL utility tool kit GLUT. GLUT was used in Blender until the point that Blender needed to be ported to Apple's Mac OSX. Blender needed a number of modifications in GLUT to work but the GLUT sources for OSX were unavailable at the time. The decision was made to build our own replacement for GLUT. In those days, NaN Technologies BV was the company that developed Blender.

Enough history. What does GHOST have to offer?
In short: everything that Blender needed from GLUT to run on all its supported operating systems and some extra's. This includes :

  • Time(r) management.
  • Display/window management (windows are only created on the main display).
  • Event management.
  • Cursor shape management (no custom cursors for now).
  • Access to the state of the mouse buttons and the keyboard.
  • Menus for windows with events generated when they are accessed (this is work in progress).
  • Video mode switching.
  • Copy/Paste buffers.
  • System paths.

Font management has been moved to a separate library.

Platforms

GHOST supports the following platforms:

  • OSX Cocoa.
  • Windows.
  • X11.
  • SDL2 (experimental).
  • NULL (headless mode).

GHOST

GHOST is not build standalone however there are tests in intern/ghost/test

Interface

GHOST has two programming interfaces:

  • The C-API. For programs written in C.
  • The C++-API. For programs written in C++.

GHOST itself is written in C++ and the C-API is a wrapper around the C++ API.

The C++ API consists of the following files:

For an example of using the C++-API, have a look at the GHOST_C-Test.cpp program in the ?/ghost/test/gears/ directory.

The C-API

To use GHOST in programs written in C, include the file GHOST_C-API.h in your program. This file includes the GHOST_Types.h file for all GHOST types and defines functions that give you access to the same functionality present in the C++ API.
For an example of using the C-API, have a look at the GHOST_C-Test.c program in the ?/ghost/test/gears/ directory.

Work in progress

Todo:
write WIP section