User:Callahanp/Flightgear and Simgear code/Graphics

From FlightGear wiki
Jump to navigation Jump to search
WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.

This page is a work in progress

This page is in the early stages of development. The focus is on how graphics is implemented in Flightgear and how in depth knowledge of that usage can be gained. It is not intended to act as a reference page, rather as a guide to acquiring requisite knowledge.

While a work in progress it may serve as a preliminary work on new wiki pages on the topic of graphics. At present it is a bit of a dumping ground for things I've poked around at in the code.

The page likely contains sections that are incomplete. Some of what is written during development may be inaccurate in some respect. Please do not refer to information on this page with links in other wiki pages until it has been moved to something other than a personal page.

Getting Started with Flightgear's Graphics Implementation

I'm going to try to understand exactly how everything you see in a Flightgear window gets there. Since I'm a beginner at this aspect of coding, a bunch of reading is necessary. Reading resources will be drawn from the Flightgear Wiki, Wikipedia, Mailing lists for Flightgear, Open Scene Graph and Open GL and the book "Open Scene Graph - Beginner's Guide"

I recently noted discussions of using Vulkan with Open Scene Graph. Since Flightgear depends heavily on Open Scene Graph, there is likely to be experimentation among flightgear developers with Vulkan, I thought it would be a good idea to learn some of the basics of Open Scene Graph to get ready to understand any effort in that area.

When delving into a new area, I usually start with lists of details I think I'll need to know about and ask advice of others on how to proceed. Advice brings particular items to the the foreground and motivates me to restructure my efforts to look at important things first. In this case, early advice was to learn about Open Scene Graph. Mathias Fröhlich and Tim Moore may know this area of Flightgear very well.

My approach has several phases.

  1. scan the code looking for relevant strings for include files, namespaces, classes, inheritance usage. I document where they are found in a way that lends itself to filling in relevant details later. In the case of graphics, this has proven to generate some very big lists of topics to explore. Although the lists are daunting, they give me an overview of what I need to learn, and a sense of the scope and scale of various features I'll have to learn about.
  2. fire up the application in the debugger. Start stepping through, establishing breakpoints in areas thought to bring the big picture into focus. I'll be looking for the sequence of the code path and trying to understand the flow of information and control.
  3. Write some more, organize and pare down large lists to a core set of classes and methods, probably focusing on any that are always executed in the loop.
  4. Further investigate and write about items that are executed on an as-needed basis.
  5. Finalize the list of things that are merely mentioned or listed.
  6. Get feedback
  7. Revise
  8. Publish

Here are some links to things to read

The Event Loop

The flightgear event loop has The first part initializes the application and updates the flight model The second renders updates to the screen.

Here's the code that renders

      viewer->frame( globals->get_sim_time_sec());
Section Development Plan
To Do: Initial exploration in the debugger
To Do: Document the major steps in the rendering update
To Do: Figure out what the viewer->frame() call is really about

Observable Artifacts in Flightgear Dependent on Graphics

Table of Observable Features

! What you see How it's Implmented
Chat Text & Dialog
Heads Up Display
Frame Statistics
Land Cover
Waterways and Lakes
Aircraft (mine, multiplayer and AI)
Ice on Wings
Sun, Stars & maybe planets and satelites.

Basic questions to answer about how what you see is implemented

  • Which libraries are used for what
  • What are the steps needed to produce the next frame to display
  • How do things like menus and dialogs land on top of the view
Section Development Plan
Todo: describe the specific Flightgear/Simgear software involved in displaying the items.
Todo: Turn the basic questions into narratives
Todo: Describe Canvas, OSG, QTQuick, Qt5 and Plib and the relationships between them as implemented in flightgear


There are a number of important terms used in graphics programming. You will quickly become familiar with quite a few of them. To get an idea of what they are, examine the list of osg includes, the list of classes inheriting from an OSG class, and other lists in this page. You'll find english words that have specific meaning in the context of Flightgear, Simgear or OSG.

General Topic or Context Term Definition/References
OSG Viewer Example
Camera Example
Alpha Example
Geode Example
Viewport Example
Shade Example
Rendering Example
Model Example
Frame Example
Texture Example
Scene Graph A [Tree] or [Directed Acyclic Graph* containing leaves that describe a scene to be rendered in 2d or 3d. A Scene Graph Library may include software that renders the content of scene graph either directly or through an underlying graphics library.
  • A Directed Acyclic Graph differs from a tree. A node on a Directed Acyclic Graph can have more than one parent node. A node on a tree can have only one parent. Some Scene Graph software such as Java3D use Directed Acyclic Graphs. Others such as OpenSceneGraph use trees.


Canvas Example
OSG (continued) Boundary, Bounding, Bounding Circle, Bounding Sphere Example
Eye Point Example
Geometry Example
Shape Example
Tesselation Example
State and State Set Example
Level of Detail (LOD) Example
Example Example
Example Example
Example Example
Example Example
Example Example
OSG (continued

add these maybe:

  • Some Math concepts? (out of scope?)
    • Matrix & Matrix Transform
    • Polygon
    • Vector
    • Polar
    • Bezier Curve
    • Rotation
    • Intersection
    • Inverse
    • Observer
    • Notifier
    • Plugin

  • Some Computer Science concepts? (out of scope?)
    • Node & Node Visitor
    • Object
    • Clone
    • Inheritance
    • threading
    • Functor
    • NaN
    • Parent
    • Buffer
    • Child
    • root
    • getters & Setters
    • Callback
    • Wrapper
  • OSG Components
    • GA
    • GUIEventAdapter
    • GUIActionAdapter
  • Scene Graph concepts
    • Particle
    • Scene Branch
    • Node
    • Group
    • Matrix
    • State
    • Adapter
    • Object
    • State & State Attributes
    • Registry
    • Draw, ,Draw Element, Draw Arrays
    • Primitive
    • Cull
    • Projection
    • Depth
    • Material
    • GLU
    • DB
    • Text, Font, Aspect
    • Stroke
    • Background
    • Cursor
    • Position/Attitude
    • Graphics Context
    • Blend
    • Alpha
    • Face
    • Light Source
    • Shadow
    • Uniform
    • Selection, Automatic
    • Manipulator
    • Drawable
    • Frame
    • Order
  • Flightgear Graphic Concepts
    • Hotspot
    • Panel
    • Background, Multi-Background
    • Layer
    • Mask
    • Classic vs Deferred
    • Pipeline
  • Other Flightgear Concepts
    • Tie

Graphics Libraries

Section Development Plan
To Do: Find out from others if a glossary is needed
To Do: Organize the glossary into sections
To Do: Actually write about some of the topics

Open Scene Graph

Open Scene Graph is a set of core libraries based on OpenGL and OpenThreads. It includes additional libraries called NodeKits.

Open Scene Graph -- Core Libraries
Component Name Description
  • basic elements of scene graphs including nodes, geometries, rendering states and textures
  • management tools and methods for these elements
  • mathematical tools including matrix and vector objects to support 2d and 3d spaces
  • File and Stream I/O
  • Dynamic load and unload management of parts of a scene graph
  • Rendering Support
  • Scene Graph Tree Traversal
  • Culling
  • Conversion of the scene graph into OpenGL calls
  • Functions modifying parts of the Scene Graph

Open Scene Graph -- NodeKit Libraries
Component Name Description
osgFX Special Effects
osgGA GUI Abstraction, keyboard and mouse support
osgManipulator Moving, Scaling and Rotation
osgParticle Smoke, Fire, Clouds, Rain
osgShadow Shadow Rendering
osgSim Special features related to simulation
osgTerrain Terrain, Hieght and Imagery
osgText 2D and 3D Text
osgViewer Viewers integrate multiple scene graphs and provide support for rendering
osgVolume Volume rendering techniques
osgWidget 2d GUI Widget set
osgQt Display Web Pages and support for QT Widgets

NodeKit libraries are highlighted with Bold Face Type above to indicate that they are important to basic understanding of Open Scene Graph as used in Flightgear. The choices are arguable.

Open Scene Graph has additional libraries that can act as plug-ins. see: [Open Scene Graph Plug-in list]


Section Development Plan
Find out where OpenThreads is in OSG=
Find out which Nodekits are important in Flightgear and how they are used

Vulkan Scene Graph



see also VulkanSceneGraph

"Vulkan support for iOS and macOS has not been announced by Apple, but at least one company provides a Vulkan implementation that runs on top of Metal on iOS and macOS devices."]]

But: [Khronos 2/26/2018 Press Release: Vulkan Applications Enabled on Apple Platforms]

Section Development Plan
To Do: Follow the development of Open Scene Graph, Vulkan and OpenGL
To Do: Update this section periodically to reflect discussion of or changes to the use of scene graphs in Flightgear

Search the Flightgear mailing list, wiki and forum for OSG related discussions

To Do: List relevant discussions and provide links

Scan the flightgear/simgear code for osg specific names

Make a source directory with symbolic links to the Flightgear and Simgear source trees. Then use grep, sed and sort commands to extract osg references of various types

You can find osg referencing code in nearly every Flightgear or Simgear Directory. A few directories will account for most of the usage. In the table below, directories in bold face are likely to be the important ones.

This command

grep -iRl osg | sed 's/[^\/]\+$//' |sed '/./s/^/* /'| sort --unique

and a few manual edits yields the following table of Flightgear and Simgear Directories with OSG references.

Flightgear Directory Simgear Directory
  • AIModel
  • Airports
  • ATC
  • Canvas
  • Cockpit
  • Cockpitbuilt_in
  • Environment
  • FDM
  • GUI
  • Input
  • Instrumentation
  • Main
  • Model
  • MultiPlayer
  • Network/http
  • Scenery
  • Scripting
  • Viewer
  • canvas
  • environment
  • nasal/cppbind
  • scene
  • screen
  • structure
  • xml


We'd like to see any Open Scene Graph namespaces declared in Flightgear or Simgear

grep -Rh "osg"|grep -v "#include"|grep namespace|sed -e "s/namespace//;s/using//;s/{.*//;s/;//;/^}/d;s/[ ]*osg/osg/;s/[ \t]// " |sort --unique
OSG Namespace used in Flightgear

Are we missing osgEA?

Section Development Plan

Notes: * are there really two similarly named namespaces? Are there namespaces for the sim and Text components of OSG?

To Do: Is the namespace osgUtil or osgUtils or are both namespaces
To Do: Describe the 8 namespaces found
To Do: Find out why there are not more namespaces


OSG components are independent libraries within Open Scene Graph To identify OSG components used by flightgear/simgear, parse component names out the #include statements like #include <osgDB/ReadFile>. Here the component is osgDB.

grep -Rhoe "#include[ t]*[<]osg[a-zA-Z1-9]*" |wc -l
grep -Rhoe "#include[ t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/[ \t]*//;s/#include</;s/>//'

|sort --unique

OSG Component used in Flightgear
  • osg
  • osgDB
  • osgGA
  • osgParticle
  • osgSim
  • osgText
  • osgUtil
  • osgViewer
Section Development Plan
To Do: Combine with the Namespace section
To Do: Describe the component

include directives

There are 162 #include directives in flightgear and simgear. There are a number of ways to look at them in the code:

  • List them all
  • List them all as used in flightgear separately from simgear
  • Generate a command to list the files where a specific include is found
  • Generate a command to count the files where a specific include is found.
grep -Re "#include[ \t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/#include <//;s/>//;s/[ \t]*//;s/[\/].*[:]/|/;s/$/|/;'|sort --unique
grep -Re "#include[ \t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/#include <//;s/>//;s/[ \t]*//;s/[\/].*[:]/|/;s/$/|/;'|sort --unique|wc -l

grep -Rhe "#include[ \t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/#include <//;s/>//;s/[ \t]*//;s/[\/].*[:]/|/'|sort --unique|sed -e 's/[ \t].*//;s/^/grep -Rl /;s/$/\| sort --unique
grep -Rhe "#include[ \t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/#include <//;s/>//;s/[ \t]*//;s/[\/].*[:]/|/'|sort --unique|sed -e 's/[ \t].*//;s/^/grep -Rl /;s/$/\| wc -l/'

You'll find that some includes occur in a fair number of code files. If an include is common, you'll probably want to know something about it. Others, which may occur less frequently are also important.

The following includes occur a number of files and are likely candidates for early learning:

  • osg/Geode
  • osg/Geometry
  • osg/Group
  • osg/Matrix
  • osg/ref_ptr
  • osg/State
  • osg/StateSet
  • osg/Texture
  • osg/Texture2D
  • osg/Version
  • osg/Viewer
  • osgDB/Registry

The following occur fewer times but are likely to be important

  • osg/Array
  • osg/Camera
  • osg/BoundingBox
  • osg/CameraView
  • osg/FrameBufferObject
  • osg/drawable
  • osg/GL
  • osg/GLU
  • osg/GraphicsContext
  • osg/Matrix, Matrixd, Matrixf, MatrixTransform
  • osgDB/callbacks
  • osgDB/Input
  • osgDB/SharedStateManager

Whatever I do end up looking at, I'll try to write a description of the module and point out examples where it's used. Here's the complete list.

flightgear||osg/Geode A geode is an ordinary seeming lump of rock on the outside and has lots of sparkly stuff lining its inner surface. An OSG geode is an ordinary leaf node containing a set of things to be rendered. How sparkly is that? The writer is a rock hound... Waht can I say... flightgear||osg/PolygonOffset||
Where Used include Used For
flightgear osg/AlphaFunc
flightgear osg/ArgumentParser
flightgear osg/Array
flightgear osg/BlendFunc
flightgear osg/BufferObject
flightgear osg/Camera
flightgear osg/CameraView
flightgear osg/CullFace
flightgear osg/CullStack
flightgear osgDB/DatabasePager
flightgear osgDB/FileNameUtils
flightgear osgDB/FileUtils
flightgear osgDB/ReaderWriter
flightgear osgDB/ReadFile
flightgear osgDB/Registry
flightgear osgDB/WriteFile
flightgear osg/DeleteHandler
flightgear osg/Depth
flightgear osg/Drawable
flightgear osg/Fog
flightgear osg/FrameBufferObject // for GL_DEPTH_STENCIL_EXT on Windows
flightgear osg/FrameBufferObject // For texture formats
flightgear osgGA/DriveManipulator
flightgear osgGA/FlightManipulator
flightgear osgGA/GUIEventAdapter
flightgear osgGA/GUIEventHandler
flightgear osgGA/KeySwitchMatrixManipulator
flightgear osgGA/StateSetManipulator
flightgear osgGA/TerrainManipulator
flightgear osgGA/TrackballManipulator
flightgear osg/Geometry
flightgear osg/GL
flightgear osg/GLU
flightgear osg/GraphicsContext
flightgear osg/GraphicsThread
flightgear osg/Group
flightgear osg/Hint
flightgear osg/io_utils
flightgear osg/Light
flightgear osg/LightModel
flightgear osg/LightSource
flightgear osg/LineWidth
flightgear osg/LOD
flightgear osg/Material
flightgear osg/Math
flightgear osg/Matrix
flightgear osg/Matrixd
flightgear osg/MatrixTransform
flightgear osg/Node
flightgear osg/NodeCallback
flightgear osg/NodeVisitor
flightgear osg/Notify
flightgear osg/observer_ptr
flightgear osg/PagedLOD
flightgear osg/PolygonMode
flightgear osg/PositionAttitudeTransform
flightgear osg/PrimitiveSet
flightgear osg/Program
flightgear osg/Quat
flightgear osg/Referenced
flightgear osg/ref_ptr
flightgear osg/RenderInfo
flightgear osg/ShadeModel
flightgear osg/Shape
flightgear osg/State
flightgear osg/StateSet
flightgear osg/Switch
flightgear osg/TexEnv
flightgear osg/TexGen
flightgear osg/TexMat
flightgear osgText/String
flightgear osgText/Text
flightgear osg/Texture
flightgear osg/Texture2D
flightgear osg/TextureRectangle
flightgear osg/Transform
flightgear osgUtil/CullVisitor
flightgear osgUtil/IntersectionVisitor
flightgear osgUtil/LineSegmentIntersector
flightgear osgUtil/RenderBin
flightgear osgUtil/SceneView
flightgear osgUtil/Tessellator
flightgear osg/Vec3
flightgear osg/Vec3d
flightgear osg/Version
flightgear osg/View
flightgear osgViewer/api/Cocoa/GraphicsWindowCocoa
flightgear osgViewer/api/Cocoa/GraphicsWindowCocoa
flightgear osgViewer/api/Win32/GraphicsWindowWin32
flightgear osgViewer/GraphicsWindow
flightgear osgViewer/Renderer
flightgear osgViewer/Viewer
flightgear osgViewer/ViewerBase
flightgear osgViewer/ViewerEventHandlers
flightgear osg/Viewport
simgear osg/AlphaFunc
simgear osg/Array
simgear osg/Billboard
simgear osg/BlendFunc
simgear osg/BoundingBox
simgear osg/buffered_value
simgear osg/Camera
simgear osg/ClipNode
simgear osg/ClipPlane
simgear osg/CopyOp
simgear osg/CullFace
simgear osgDB/Archive
simgear osgDB/Callbacks
simgear osgDB/DatabasePager
simgear osgDB/FileNameUtils
simgear osgDB/FileUtils
simgear osgDB/Input
simgear osgDB/Options
simgear osgDB/Output
simgear osgDB/ParameterOutput
simgear osgDB/ReaderWriter
simgear osgDB/ReadFile
simgear osgDB/Registry
simgear osgDB/SharedStateManager
simgear osgDB/WriteFile
simgear osg/Depth
simgear osg/Drawable
simgear osg/Fog
simgear osg/FragmentProgram
simgear osg/FrameBufferObject // for GL_DEPTH_STENCIL_EXT on Windows
simgear osgGA/GUIEventAdapter
simgear osgGA/GUIEventHandler
simgear osg/Geode
simgear osg/Geometry
simgear osg/GL
simgear osg/GL2Extensions
simgear osg/GLExtensions
simgear osg/GL // for glGetString
simgear osg/GLU
simgear osg/GraphicsThread
simgear osg/Group
simgear osg/Image
simgear osg/LOD
simgear osg/Material
simgear osg/Math
simgear osg/Matrix
simgear osg/Matrixd
simgear osg/MatrixTransform
simgear osg/Node
simgear osg/NodeCallback
simgear osg/NodeVisitor
simgear osg/Notify
simgear osg/Object
simgear osg/observer_ptr
simgear osg/PagedLOD
simgear osgParticle/ConnectedParticleSystem
simgear osgParticle/ConstantRateCounter
simgear osgParticle/FireEffect
simgear osgParticle/FluidProgram
simgear osgParticle/ModularEmitter
simgear osgParticle/MultiSegmentPlacer
simgear osgParticle/Particle
simgear osgParticle/ParticleSystem
simgear osgParticle/ParticleSystemUpdater
simgear osgParticle/PrecipitationEffect
simgear osgParticle/SectorPlacer
simgear osgParticle/SmokeTrailEffect
simgear osg/Point
simgear osg/PointSprite
simgear osg/PolygonMode
simgear osg/PolygonOffset
simgear osg/PositionAttitudeTransform
simgear osg/PrimitiveSet
simgear osg/Program
simgear osg/ProxyNode
simgear osg/Quat
simgear osg/Referenced
simgear osg/ref_ptr
simgear osg/RenderInfo
simgear osg/Sequence
simgear osg/ShadeModel
simgear osg/Shader
simgear osg/Shape
simgear osg/ShapeDrawable
simgear osgSim/Impostor
simgear osg/State
simgear osg/StateAttribute
simgear osg/StateSet
simgear osg/Stencil
simgear osg/Switch
simgear osg/TemplatePrimitiveFunctor
simgear osg/TexEnv
simgear osg/TexEnvCombine
simgear osg/TexGen
simgear osg/TexMat
simgear osgText/Font
simgear osgText/Text
simgear osg/Texture
simgear osg/Texture1D
simgear osg/Texture2D
simgear osg/Texture3D
simgear osg/TextureCubeMap
simgear osg/TextureRectangle
simgear osg/Transform
simgear osg/TriangleFunctor
simgear osg/Uniform
simgear osgUtil/CullVisitor
simgear osgUtil/HighlightMapGenerator
simgear osgUtil/IntersectionVisitor
simgear osgUtil/LineSegmentIntersector
simgear osgUtil/Optimizer
simgear osgUtil/RenderBin
simgear osgUtil/RenderLeaf
simgear osgUtil/Simplifier
simgear osgUtil/TangentSpaceGenerator
simgear osgUtil/UpdateVisitor
simgear osg/Vec2
simgear osg/Vec2d
simgear osg/Vec2f
simgear osg/Vec3
simgear osg/Vec3d
simgear osg/Vec3f
simgear osg/Vec4
simgear osg/Vec4d
simgear osg/Vec4f
simgear osg/Version
simgear osg/VertexProgram
simgear osgViewer/Viewer
Section Development Plan
To Do: Organize includes into groups
To Do: Describe the groups or individual includes

OSG Classes Inherited by Simgear or Flightgear Classes

grep -Rhe "^[ \t]*class.*osg" |sed -e 's/class //;s/{//'|sort --unique
Open Scene Graph Class inherited ! Flightgear or Simgear Classes
osg::NodeVisitor BoundingVolumeBuildVisitor

SGAnimation - protected

Node Callback

FGRenderingPipelineosg::Referenced FGDeferredRenderingCameraCullCallback


ReaderWriterSTG||osgDB::ReaderWriter ReferencedSingleton||virtual osg::Referenced SGMaterialCache



GraphicsWindowQt5 osgViewer::GraphicsWindow
Flightgear or Simgear Class Open Scene Graph Class inherited
<osg::Texture> TextureBuilder
osg::Camera PUICamera
osg::CopyOp CopyOp
osg::Drawable CloudShaderGeometry
osg::Drawable FGPanelNode
osg::Drawable PUIDrawable
osg::Drawable QQuickDrawable
osg::Drawable SGHUDDrawable
osg::Drawable SGVasiDrawable
osg::Drawable ShaderGeometry
osg::Drawable::ComputeBoundingBoxCallback SGEnlargeBoundingBox
osg::GraphicsOperation GraphicsContextOperation
osg::GraphicsOperation RetriveGraphicsThreadOperation
osg::Group ConditionNode
osg::Group SplashScreen
osg::NodeCallback SGScaleAnimation::UpdateCallback
osg::NotifyHandler NotifyLogger
osg::Object Effect
osg::Object SGSceneUserData
osg::Object Technique
osg::Observer SGDatabaseReference
osg::Operation SyncPolishOperation
osg::PrimitiveFunctor PrimitiveCollector
osg::StateAttribute::Callback FGFogUpdateCallback
osg::StateAttribute::Callback FGHintUpdateCallback
osg::StateAttribute::Callback FGLightModelUpdateCallback
osg::StateAttribute::Callback FGWireFrameModeUpdateCallback
osg::StateSet Pass
osg::StateSet::Callback FGFogEnableUpdateCallback
osg::Transform SGBillboardAnimation::Transform
osg::Transform SGDistScaleAnimation::Transform
osg::Transform SGFlashAnimation::Transform
osg::Transform SGOffsetTransform
osg::Transform SGRotateTransform
osg::Transform SGScaleTransform
osg::Transform SGTranslateTransform
osgDB::DatabasePager SceneryPager
osgDB::Options SGReaderWriterOptions
osgDB::ReaderWriter ReaderWriterPGT
osgDB::ReaderWriter ReaderWriterSPT
osgDB::ReaderWriter SGReaderWriterBTG
osgDB::ReaderWriter SGReaderWriterXML
osgDB::ReadFileCallback OptionsReadFileCallback
osgDB::Registry::ReadFileCallback ModelRegistryCallback
osgDB::Registry::ReadFileCallback, ModelRegistry
osgGA::GUIEventHandler DeletionManager
osgGA::GUIEventHandler FGEventHandler
osgGA::GUIEventHandler GraphDumpHandler
osgGA::GUIEventHandler PUIEventHandler
osgParticle::ModularEmitter, osg::Observer CustomModularEmitter
osgUtil::CullVisitor EffectCullVisitor
osgUtil::RenderBin SGClipGroup::ClipRenderBin
osgUtil::UpdateVisitor SGUpdateVisitor
osgViewer::StatsHandler FGStatsHandler
osg::ref_ptr FlagTester
osg::Camera::DrawCallback ScreenshotCallback:
Section Development Plan
To Do: Organize classes into groups
To Do: Describe the groups or individual classes
To Do: Make sure there are no multiple inheritance items missed
To Do: Many OSG Classes are used directly. This use may predominate for some classes.
To Do: Some of the classes inheriting from OSG are used extensively. For example SGGeode appears over 1300 times and is found in 231 files. class relationships like this can be found by searching the codebase for single keywords. In this case it was "Geode"


601 examples of using new to instantiate an Open Scene Graph object 444 of them are unique.

grep -Rh osg|grep -v "#include"|grep -v class|grep -v  "virtual" |sed -e 's/^[ \t]*//g;s/[\(][ \t]*/\(/'|grep new|sort --unique|

Method Calls

141 unique virtual functions defined with osg parameters 4095 unique function calls involving osg

grep -Rh osg|grep -v "#include"|grep -v class|grep -v  "virtual" |sed -e 's/^[ \t]*//g;s/[\(][ \t]*/\(/'|sort --unique
Section Development Plan
To Do: What's the purpose of this section
To Do: Describe the virtuals
To Do: Make sure there are no multiple inheritance items missed

OSG Topics

As a result of the scan, develop a list of topics based on the presence of a set of English words used in the context of OSG specific names

Here's one way to scan that highlights each use of an OSG namespace. It does not catch anything that uses any of osg without including the letters osg in the line of code.

in the directory above your git clones for things like next, osg, plib etc, create a directory named source

cd Source

Create symbolic links to flightgear -> ../next/flightgear/src simgear -> ../next/simgear/simgear

~/fg$ grep -R osg * | sed 's/xx:/xx : /'|sed 's/\(.*\): \(.*\)/\2 : \1/' | sed 's/^[\t ]*//'| sed 's/\(.*\)\(osg.*::[A-Za-z0-9]*\)\(.*\)/\2 : \1\2\3/'|sort>../osg_refs.txt cd .. gedit osg_refs.txt

What you have is a sorted list of usages of various kinds of elements of osg


  • fg_os_common, fg_os_viewer and osgViewer.
  • FGRenderer and osg Camera
  • the GUI and an osg Camera

Model/Scene :

  • Shade Model
  • osg read/write and the simgear model registry
  • osg Light Model and Light Source
  • osg Texture, texture object manager, texture Building, Env, Env Combine, Material, 2D, Cube Map, CLAMP, Linear, Nearest, Repeat, Compression. see simgearSceneFeatures
  • osg Image
  • osg Geometry and BIND
  • osg Point
  • LOD - Paged LOD
  • osg Particle
  • osg Polygon -- Mode, Offsets,
  • Osg Geode
  • Bounding Box & Bounding Sphere
  • osg GL Extensions and Simgear Scene Features
  • Scene View
  • Tesselate
  • Update Visitor
  • osg Nodes: Lists, Callbacks, Paths, Visitors
  • osg proxy node, registration


  • osg copy operations for various kinds of transformations: Translate, Offset, Rotate, Enlarge Bounding Box, Scale among others
  • Vector -- 2, 2b, 2d, 2f, 3, 3d, 3f 4 vector 3 array, 4, 4d 4f array 1300 occurrances.
  • osg Matrix, Matrixd and Matrixf, Matrix Transforms, Local Matrix
  • osg PositionAttitudeTransform
  • osg Transform -- Absolute,


  • OsgViewer and window attributes
  • Camera and Camera View
  • osg Viewer, ViewerBase, Viewport
  • osg Camera BufferComponent, Camera Addition and Deletion
  • "applying" an osgCamera to various fg objects
  • osg Drawable, Draw Elements and Draw Arrays



  • Camera, rendering order and nesting
  • Rendering, Rendering hints, Renderer, Rendering Info, Render Bin, Leaf, Stage,
  • Graphics Window
  • osg Graphics Context, Operations
  • osg drive and flight manip* osg Framestamp


  • osg Framestamp


  • AlphaFunc
  • BlendFunc
  • osg Array
  • osg Copy
  • Cull
  • OSG DB
  • osg Groups, Objects and animation,
  • osg Notify
  • osg Depth
  • osg Ref, Referenced, Ref Matrix --The use of reference pointers for some osg objects
  • osg
  • osg output
  • osg deep and shallow copy operations
  • OSGEA - Events, Actions, Adapters
  • osg equivalent
  • osg Objects, Dynamic, Static,
  • osg Observer
  • osg State, State Attribute, State Set
    • OsgDb Options, Cache,
  • osg Quat
  • osg Primitive -- Primitive Set, Functor, Template Primitive Functor
  • Sequence
  • osg Switch
  • osg Text
  • osg Utilities
  • osg debugging

Simgear: What's a vasiDrawable

Section Development Plan
To Do: Write a narrative describing osg usage
To Do: Choose specific topics to focus on for research
To Do: Collect Topic References

OSG Examples

Code some OSG examples from the book

Section Development Plan
To Do: Read book and work exercises

In the Open Scene Graph -- Beginner's Guide, there are a number of examples.

#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
int main( int argc, char** argv )
osgViewer::Viewer viewer;
viewer.setSceneData( osgDB::readNodeFile("cessna.osg") );

Hello World - OSG Style

This very basic file uses a .osg file to display an aircraft. Flightgear does not use .osg files, you can probably skip this example after reading through it.

To Do: Choose sections of the book to highlight
To Do: Write notes about a section or topic in the book
To Do: Combine this section with the OSG Topics Section

Code Walkthroughs

Step through selected OSG related modules in Flightgear/Simgear, observing the construction of OSG objects, exploring the object's data and following method calls that result in changes to the display. ===

Section Development Plan
To Do: Select Topics that features prominently in every main event cycle
To Do: Write a narrative

Older stuff Some lists of possibly relevant stuff

So -- How to start. A list of things one sees; a list of questions about what is seen and a list of terms to be mastered.

The lists below are not complete.

Basic vocabulary of computer graphics work

This list is gleaned from a look at flightgear and simgear's codebase with Atom's Search facility to start with and then with grep as the atom approach resulted in a list of about 8000 lines of #includes and calls to osg.

The initial Atom Search shows that there are 8900 lines containing "osg" in 343 files.

I use grep to count files and lines with "osg" and "#include <osg..."

echo Files containing \"osg\":    $(grep -iRl osg |wc -l) >result
echo Lines containing \"osg\":    $(grep -iR osg |wc -l) >>result
echo Files containing \"\#include \<osg\":  $(grep -iRle "#include.*\<osg.*>" |wc -l) >>result
echo Lines containing \"\#include \<osg\":  $(grep -iRhe "#include.*\<osg.*>" |wc -l) >>result
cat result
rm result

Note that the "osg" count from grep differs from Atom's count. Not sure why...

Now lets look at unique files to get a feel for where OSG is used:

grep -iRl osg |sort

The folder names in the output give a good indication of where in flightgear and simgear osg is used.

To indintify components used by flightgear/simgear, we have to parse component names out the #include statements like #include <osgDB/ReadFile>. here the component is osgDB.

grep -Rhoe "#include[ t]*[<]osg[a-zA-Z1-9]*" |sed -e 's/#include[ \t]<//'|sort --unique
  • osg
  • osgDB
  • osgGA
  • osgParticle
  • osgSim
  • osgText
  • osgUtil
  • osgViewer

Taking a look at items identified by the use of :: we get

grep -Rhoe "osg[a-zA-Z0-9]*[:]*"|sed s/://g|sort --unique |wc -l
grep -Rhoe "osg[a-zA-Z0-9]*[:]*"|sed s/://g|sed '/./s/^/* /'|sort --unique 
  • osg
  • osgButtonToPUI
  • osgDB
  • osgEA
  • osgFileName
  • osgGA
  • osgGetVersion
  • osgLevel
  • osgmovie
  • osgOptions
  • osgParticle
  • osgQt
  • osgshaders
  • osgShadow
  • osgSim
  • osgText
  • osgToFGModifiers
  • osgUtil
  • osgutils
  • osgviewer
  • osgViewer
  • osgworks

OSG Namespaces:

grep -Rh "osg"|grep -v "#include"|grep namespace|sed -e 's/[ \t]*//' |sort --unique

Flightgear/Simgear classes based on osg classes

grep -Rh "osg"|grep -v "#include"|grep class

identifies 124 classes and finally, calls

grep -v "#include" |grep -Rhoe "osg[a-zA-Z0-9]*[:]*[a-zA-Z0-9]*"|sort --unique|wc -l
grep -v "#include" |grep -Rhoe "osg[a-zA-Z0-9]*[:]*[a-zA-Z0-9]*"|sed '/./s/^/* /'|sort --unique
  • Viewer
  • Camera
  • Alpha
  • Geode
  • Viewport
  • Shade
  • Rendering
  • mODFEL
  • Frame
  • Texture
  • Scene Graph
  • Canvas
  • Boundary, Bounding, Bounding Circle, Bounding Sphere
  • Eye Point
  • geometry
  • Shape
  • Tesselation
  • State and State Set
  • Level of Detail (LOD)
  • Some Math concepts? (out of scope?)
    • Matrix & Matrix Transform
    • Polygon
    • Vector
    • Polar
    • Bezier Curve
    • Rotation
    • Intersection
    • Inverse
    • Observer
    • Notifier
    • Plugin

  • Some Computer Science concepts? (out of scope?)
    • Node & Node Visitor
    • Object
    • Clone
    • Inheritance
    • threading
    • Functor
    • NaN
    • Parent
    • Buffer
    • Child
    • root
    • getters & Setters
    • Callback
    • Wrapper
    • Bind
    • reference pointer
    • Event Handler
  • OSG Components
    • GA
    • GUIEventAdapter
    • GUIActionAdapter
  • Scene Graph concepts
    • Particle
    • Scene Branch
    • Node
    • Group
    • Matrix
    • State
    • Adapter
    • Object
    • State & State Attributes
    • Registry
    • Draw, ,Draw Element, Draw Arrays
    • Primitive
    • Cull
    • Projection
    • Depth
    • Material
    • GLU
    • DB
    • Text, Font, Aspect
    • Stroke
    • Background
    • Cursor
    • Position/Attitude
    • Graphics Context
    • Blend
    • Alpha
    • Face
    • Light Source
    • Shadow
    • Uniform
    • Selection, Automatic
    • Manipulator
    • Drawable
    • Frame
    • Order
  • Flightgear Graphic Concepts
    • Hotspot
    • Panel
    • Background, Multi-Background
    • Layer
    • Mask
    • Classic vs Deferred
    • Pipeline
  • Other Flightgear Concepts
    • Tie

I'm writing about this on

Draft: Here are some questions I'm going to try to get answers for:

Don't go trying to provide answers yet. I'm just gathering a good set of questions.

At some point I'll start writing a wiki page on how flightgear does graphics. A rough draft will appear first on Contributions to this effort will be welcomed. When it's been reviewed, I'll integrate the pages with the regular part of the wiki.

What are the various library components that directly produce any part of flightgear application windows What are the responsiblities of each library involved in producing application window contents. Which libraries provide overlapping areas of functionality Are any libraries specific to a platform Is any flightgear application code other than nasal code specific to an aircraft or group of aircraft?

What exactly is canvas? How is it used in flightgear What is/was Rembrant? What differs between platforms Some basics Is there a good description of how flightgear graphics is currently coded already on the wiki What is a texture and how is one used to produce scenery and aircraft What is a camera What changes when you move from one view to another What makes up a scene: Scenery Highways Buildings Terrain Vegetation Land Use Data Airports Aircraft Walker Highway Traffic? How is what is to be displayed at a given point determined What makes up the menu system (fg/sg code, library software and data) What makes up the dialog system (fg/sg code, library software and data) What are the parts of the main flightgear loop that: calculates updates to data needed for the next frame based on the passage of time use contents of the previous frame's data to affect what's in the next frame assembles data and structures needed for displaying the next frame. prepares for the imminent display of a new frame displays a new frame

On Fri, Jun 1, 2018 at 1:45 PM, xDraconian <> wrote: Hi All,

VulkanSceneGraph was just announced. Something to watch as it develops. Potentially a disruptor down the road, and perhaps a good design option to consider as it matures.

Scott (xDraconian) _______________________________________________ Flightgear-devel mailing list