| GL Studio C++ Runtime API

GL Studio C++ Runtime API

The GL Studio C++ Runtime Application Programming Interface (API) is the set of functions and classes used to interact with objects created by the GL Studio editor.

The most fundamental classes in the object hierarchy are `DisplayObject` and `Group`. `DisplayObject` is the abstract base class of all objects in the GL Studio object hierarchy. `Group`, which is itself a `DisplayObject`, represents a collection of other `DisplayObject`s.

Ordinary drawing objects such as `GLPolygon` and `GlsEllipse` are instances of `DisplayObject`. Text objects like `GlsTextBox` and `DisplayObject`, which support ASCII and Unicode for languages such as Chinese, Japanese, and Korean, and `GlsCTLTextBox`, which supports complex text layout for languages such as Arabic, Hebrew, and Thai, are also `DisplayObject`s.

Collections of objects such as `GlsPushButton`, which collects and up state and down state as well as optional background objects, and a `GlsMutexGroup`, which shows one of its children at a time, are examples of `Group`s. (Note: Catalyzers, which use Python scripts to generate their child objects at design time, also turn into `Group`s at runtime.)

Other important objects include `ComponentBase`, which allows embedding one GLS file or Reusable Software Objects (RSOs) into another, and mesh objects such as `GLTrimesh` and `GlsAdvancedMesh`, which represent complex geometry and materials; and functional objects such as `GlsEyePoint`, which acts as a camera in the scene; `GlsLightSource`, which adds lighting to a scene, and `GlsDynamicPath`, which allows the animation of some object properties over time (see also the GlsAnimation package, which can animate any property over time).

The table below lists the objects that appear in the GL Studio Toolbox and a few that are created from user actions, like `Group`s and meshes. Click the toolbox object name for a guide on how to create each object in the editor. Click on the class name to access API documentation for that object.

Object | Description | API Documentation
--- | --- | ---
Polygons |  |
Line | Click and drag the 3D Canvas to create a line. | `GLPolygon`
Free Form | Clicking places individual vertices, dragging creates scribbles, double click to finish the shape. | `GLPolygon`
Polygon | Click once for each vertex, double click to finish the shape. | `GLPolygon`
Scribble | Click and drag to create a smooth scribble. | `GLPolygon`
Rectangle | Click and drag to size a rectangle. | `GLPolygon`
Text |  |
Text Box | Creates a text box that uses kerning to space each glyph. | `GlsTextBox`
Text Grid | Creates a text box that lays out text in a fixed width grid. | `GlsTextGrid`
CTL Text Box | Creates a text box capable of supporting complex layouts, e.g. Thai, Arabic. | `GlsCTLTextBox`
Groups |  |
Group Objects | Groups the selected objects as a `Group` | `Group`
Empty Group | Creates an empty group, ready for new child objects. | `Group`
Convert to 3D Cable | Groups the selected objects and allows them to be affected by gravity and tension, like a real cable would. | `Gls3DCable`
Convert to Clipping Group | Groups the selected objects and clips geometry outside of a user defined range. | `GlsClippingGroup`
Convert to Lod Group | Groups the selected objects and draws one of the children based on how far away the viewer currently is. | `GlsLodGroup`
Convert to Mimic Group | Groups the selected objects and renders all children to a texture, improving performance. | `GlsMimicGroup`
Convert to Multi-View | Groups the selected objects and allows users to define additional viewport calculations to draw objects from multiple angles. | `GlsMultiView`
Convert to Mutex Group | Groups the selected objects and draws only one child at a time based on the current state index. | `GlsMutexGroup`
2D Shapes |  |
Angular Scale | Creates tick marks in a ring around a center point. | `GlsAngularScale`
Ellipse | Creates a circle, ellipse, or n-gon. | `GlsEllipse`
Linear Scale | Creates tick marks in a line from a starting point. | `GlsLinearScale`
Nine-Patch | Creates a rectangle that can be scaled infinitely without loss in quality. | `GlsNinePatch`
Nurb Curve | Creates a smooth curve defined by a few points. | `GlsNurbCurve`
Poly Line | Creates a scalable line. | `GlsPolyLine`
3D Shapes |  |
Sphere | Creates a sphere. | `GlsSphere`
Cylinder | Creates a cylinder or pyramid. | `GlsCylinder`
Meshes |  |
Trimesh | Converts selected objects to a mesh made of triangles | `GLTrimesh`
Imported Mesh | An imported mesh supporting more features than `GLTrimesh` such as reflection maps | `GlsAdvancedMesh`
Input |  |
Convert to Knob | Groups the currently selected objects as a knob. | `GlsKnob`
Convert to Odometer | Groups the currently selected objects as an odometer. | `GlsOdometer`
Convert to Push Button | Groups the currently selected objects as a push button. | `GlsPushButton`
Convert to Switch | Groups the currently selected objects as a switch. | `GlsSwitch`
Convert to Thumbwheel | Groups the currently selected objects as a thumbwheel. | `GlsThumbWheel`
Components and References |  |
Convert to Component | Saves the currently selected objects into a new GLS file. | `ComponentBase`
Insert an existing Component | Adds a reference to an existing GLS file or RSO into the current one. | `ComponentBase`
Catalyzer | Creates a empty group, whose children are created by Python scripts selected by the user. Catalyzers are in the GL Studio editor only. At runtime they become a `Group`. | Editor only; no runtime API.
Eyepoint and Lights |  |
Light | Creates an adjustable light source. | `GlsLightSource`
Eyepoint | Creates a camera view point, which can be set as the primary for the application. | `GlsEyePoint`
Moving Eye | Creates a camera view point capable of smoothly moving between eyepoints. | `GlsMovingEye`
Dynamic Path |  |
Insert a Dynamic Path | Creates an object that can store keyframes for an animation. | `GlsDynamicPath`
Insert a Path Manager | Creates links between objects and dynamic paths, allowing many animations to be managed by one object. | `GlsPathManager`
Video Toolkit |  |
Movie Texture | Creates a polygon that can have a video file mapped to at runtime. | `GlsMovieTexture` (Windows only)
Video to Texture | Creates a polygon that can have streaming video (from a webcam) mapped to at runtime. | `GlsVideoToTexture` (Windows only)
Schematics |  |
Schematic Poly Line Interconnect | Creates an animated scalable line used to represent flow. | `GlsSchematicPolyLineInterconnect`
Schematic Tee Interconnect | Creates a tee junction for schematic lines to intersect with. | `GlsSchematicTeeInterconnect`