Examples

There are example programs available for you to play with / understand how the different pieces fit together. The C++ examples are in nanogui/src/, and the equivalent Python examples are in nanogui/python.

Example 1

Screenshot of Example 1.

The first example program is rather long, but not altogether complicated. It is effectively an enumeration of how one would go about adding various different kinds of Widgets to the window being displayed.

Example 2

Screenshot of Example 2.

The second program demonstrates how simple label/editor widget-type layouts can be written in a very concise manner.

Example 3

The third example program demonstrates how to manage OpenGL / GLFW on your own for the C++ side, and how to detach the NanoGUI mainloop() on the Python side.

Example 4

The fourth example program demonstrates the GLCanvas widget, which renders an arbitrary sequence of OpenGL commands into a NanoGUI widget.

Example Icons

NanoGUI includes various icons made available from File entypo.h, courtesy of Daniel Bruce’s Entypo glyphs. The file level documentation is useful as a reference for selecting an icon, but the web rendering may be misleading — NanoGUI uses a dark background for widgets by default.

Run the exampleIcon executable to see what the icons look like in NanoGUI. The setup of this file may also be helpful in understanding how to control the nanogui::VScrollPanel.

Example Repository

Darren Mothersele has put together a compact and informative example repository that demonstrates how easy it is to include NanoGUI into your project. You download / browse the source on GitHub.