FlightGear and OpenGL Core Profile
This article is a stub. You can help the wiki by expanding it. |
Portability & Compatibility |
---|
Performance |
Efforts |
Objective
Some FG users are very interested in seeing how FlightGear runs on low end hardware - because they may have a collection of it :)
Probably to do it initially, gles1 would have to be used - I think gles2 has no fixed function - and simgear/flightgear would have to be patched to use only OSG calls (if possible)
I know OSG can have gles{1,2} support without windowing compiled in
Background
See Howto:Optimizing FlightGear for mobile devices for the main article about this subject. |
being able to run fgfs on such, comparatively low-powered, system is actually a good thing for fgfs as a whole - it can help us understand bottlenecks that are hardly visible on typical gaming rigs, but that may still show up over time (think leaking listeners/memory) - this sort of thing can also be considered the prerequisite for people wanting to target/build/run fgfs on other embedded hardware, such as thin clients with integrated GPUs or even mobile phones (think Android)
In other words, if the right people were to team up to specifically such hardware, this could also mean significant performance improvements for people on powerful gaming rigs.
Approach
For starters, we can try the FlightGear Headless option to build a fgfs version without any graphics at all.
The next step will be identifying and excluding problematic sources (those containing legacy/raw OpenGL code, e.g. using glBegin()
or glEnable()
respectively):
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Cockpit/render_area_2d.cxx
void RenderArea2D::RenderQuad( const SGVec2f *p) {
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 0.0f);
glVertex2fv( p[0].data() );
glVertex2fv( p[1].data() );
glVertex2fv( p[2].data() );
glVertex2fv( p[3].data() );
glEnd();
}
Example: disabling PUI
Knowing that PUI contains legacy OpenGL code and knowing it's scheduled to be removed anyway because it isn't compatible with modern OpenGL, we will disable it completely without reviewing/porting individual PUI files. This means opening $FG_SRC/CMakeLists.txt to add a new option to disable PUI.
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/CMakeLists.txt
option(SYSTEM_CPPUNIT "Set to ON to build Flightgear with the system's CppUnit library")
option(DISABLE_PUI "Set to ON to build Flightgear without PUI support")
We will be adding #ifdef
macros to the sources in question, and update CMakeLists.txt accordingly.
Ideally, in conjunction with a feature-specific build option to disable the corresponding feature (think PUI or the HUD).
Thus, after editing CMakeLists.txt, we need to open fg_init.cxx to prevent initalization of PUI: https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Main/fg_init.cxx#l1043
////////////////////////////////////////////////////////////////////
// Create and register the XML GUI.
////////////////////////////////////////////////////////////////////
#if 0
globals->add_subsystem("gui", new NewGUI, SGSubsystemMgr::INIT);
#endif
So, after editing fg_init.cxx to prevent the PUI GUI from getting initialized by FlightGear, we will need to find remaining hard-coded references to it, to fix those up and deal with PUI not being available.
See Developing using CMake for the main article about this subject. |
We should add separate build options to explicitly disable these features individually, e.g.:
-DDISABLE_PUI
-DDISABLE_2DPANELS
Successfully disabling a feature means primarily:
- adding a corresponding new build option to the top-level CMakeLists.txt (e.g. DISABLE_PUI)
- opening fg_init.cxx and navigating to the lines where the feature/subsystem is initialized
- wrapping the corresponding code in between
#ifdef...#endif
blocks - locating any remaining references to the subsystem in question and repeating the last step there
Affected Features / Sources
Feature | Directory | Notes | Status |
---|---|---|---|
PUI | $FG_SRC/GUI | can be replaced via Phi | Pending |
2D Panels | $FG_SRC/Cockpit | legacy 2D panels (could use Canvas) | Pending |
Canvas Path (Shiva) | $SG_SRC/canvas | needs some thinking, probably native OpenVG on RPi [1] [2] or an OpenGL based implementation like nanovg [3] | Pending |
Effects | $FG_ROOT/Effects | not important for the time being, will include Shader and probably involve a custom Compositor pipeline | Pending |
Porting
Vertex Buffer Objects
Canvas.Path (OpenVG)
Forum topics
See also
- FlightGear Headless
- Howto:Optimizing FlightGear for mobile devices
- Graphics card profiles
- Canvas and OpenGL ES
- FlightGear and old Hardware
- Compositor
References
References |