PUI: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 75: Line 75:
About-dialog-rendered-by-canvas.png|Screenshot showing a dialog rendered by the [[Howto:Processing legacy PUI dialogs using Canvas|pui2canvas parser]]
About-dialog-rendered-by-canvas.png|Screenshot showing a dialog rendered by the [[Howto:Processing legacy PUI dialogs using Canvas|pui2canvas parser]]
</gallery>
</gallery>
== Troubleshooting ==
[[File:Broken PUI.png|thumb|PUI fonts broken]]
=== Broken Fonts ===
{{See also|Menubar#Styles}}
{{WIP}}
Note that there is global GUI style (the default is called Anthrax and can be found in [[index.php?title=$FG ROOT&amp;oldid=88774|$FG ROOT]]/gui/Styles/anthrax.xml).  If I recall correctly, transparency is one of the things that can be altered.<ref>{{cite web
  | url    = http://forum.flightgear.org/viewtopic.php?p=270568#p270568
  | title  = <nowiki>Re: Disabling fuel consumption</nowiki>
  | author = <nowiki>Johan G</nowiki>
  | date  = Dec 29th, 2015
  | added  = Dec 29th, 2015
  | script_version = 0.25
  }}
</ref>
Press shift-F10 to switch to the rather oddly-named "anthrax" GUI theme. You should find that not only do your menus look much better, but your sky bug disappears!
* http://forum.flightgear.org/viewtopic.php?f=21&p=280537#p280537
* http://forum.flightgear.org/viewtopic.php?f=37&t=28262&p=269145&hilit=anthrax#p269073
* http://forum.flightgear.org/viewtopic.php?f=37&t=24022&p=218196&hilit=amd+style#p218196


== References ==
== References ==
{{Appendix}}
{{Appendix}}
[[Category:Software]]
[[Category:Software]]

Revision as of 09:44, 3 October 2017

Caution  The feature documented below, in its current form, is currently being scheduled/expected (or discussed) to be significantly updated, or phased out, in future FlightGear versions + (rough estimate). This should be taken into account if you're interested in working on the feature or developing it further. If in doubt, please get in touch via the devel list first.

(PUI is likely to be removed to help improve compatibility with OSG/OpenGL 3.x and improve performance by phasing out legacy OpenGL code. Therefore, people should be careful when using/extending the PUI based legacy GUI engine[1][2] and coordinate any related work with the devel mailing list-this applies particularly to adding any additional hard-coded PUI widgets.)

FlightGear GUI dialog (exit.xml)stored in $FG_ROOT/gui/dialogs


Custom-autopilot-dialog.png

PUI is the standard GUI engine used in FlightGear, it is part of PLIB and is using raw, fixed-pipeline, OpenGL code internally (no OpenSceneGraph). PUI provides a fairly basic, but robust, set of widgets. PUI is also used for rendering the Menubar:

Menubar2.jpg

In FlightGear, PUI dialogs are standard PropertyList XML Files that are stored in $FG_ROOT/gui/dialogs, they can contain the widgets mentioned in $FG_ROOT/Docs/README.gui, using a simple layout engine discussed in $FG_ROOT/Docs/README.layout, and bindings using a combination of so called fgcommands (see $FG_ROOT/Docs/README.commands) and custom Nasal code. In addition, each PUI/XML dialog may contain Nasal sections that are executed when opening/closing the dialog, a feature which is commonly used for procedurally creating/updating widgets using the cmdarg() API, which allows the dialog tree to be traversed and manipulated prior to the dialog being rendered. Widgets can be conditionally hidden/shown using a wrapper for SGCondition in props.nas The canvas widget also supports its own embedded Nasal section to execute arbitrary widget specific Nasal code.

PUI/XML dialogs can be loaded, dynamically created, updated and closed using a handful of fgcommands:

  • dialog-new
  • dialog-show
  • dialog-update
  • dialog-apply
  • dialog-close

PUI related OpenGL code is particularly infamous for causing rendering artifacts for people on AMD/ATI and Intel hardware (especially in combination with certain styles and effects/shaders).

PUI is also known to affect rendering performance quite significantly, while also preventing FlightGear from using a more recent version of OpenGL[3][4].

However, improving the frame-rate and modernised 3D rendering, can’t be worked on until the PUI code, 2D panels and Shiva are removed, but doing so is a frustrating slow path[5]

Besides, while most people seem to agree PUI needs to be replaced, it sounds as if the fallout from doing so would be more painful (cumulatively) than the pain its existence causes.[6]

But given that with many graphics drivers PUI doesn't render correctly when higher shader quality is on, graphics folks are also convinced it needs to be replaced.[7]


In addition, OpenSceneGraph (OSG) can obviously not help optimize any PUI related GL code and PUI widgets are generally considered to be pretty archaic and not easy to extend[8][9][10].

Note  We use the GUI code from PLIB, which doesn't know anything about OSG. See the SGPuDrawable class in $FG_SRC/Viewer/renderer.cxx for the implementation. The one catch is that OSG has a strong notion of separation between the update of a "scene" and its rendering, and that might not play well with arbitrary existing OpenGL code.

For these reasons, we're hoping to phase out PUI in FlightGear. One of the lowest hanging fruits is re-implementing the Menubar by using a Nasal/Canvas translator

Canvas-menubar-jabberwocky-09-2014.png

As of late 2015, there is heavy activity towards providing alternatives to a PUI-based UI:

References

References