{"id":13813201,"url":"https://github.com/mitsuba-renderer/nanogui","last_synced_at":"2025-05-14T17:08:30.969Z","repository":{"id":37502816,"uuid":"97938994","full_name":"mitsuba-renderer/nanogui","owner":"mitsuba-renderer","description":"Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL","archived":false,"fork":false,"pushed_at":"2025-04-23T12:27:52.000Z","size":5291,"stargazers_count":1660,"open_issues_count":80,"forks_count":204,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-04-23T13:47:49.230Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitsuba-renderer.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-21T11:04:44.000Z","updated_at":"2025-04-23T12:27:56.000Z","dependencies_parsed_at":"2024-01-31T09:05:04.989Z","dependency_job_id":"2445b6ab-9a9f-4ede-8b72-8542850e97de","html_url":"https://github.com/mitsuba-renderer/nanogui","commit_stats":{"total_commits":514,"total_committers":54,"mean_commits":9.518518518518519,"dds":0.5097276264591439,"last_synced_commit":"2ee903c96480d4aee54542ea3c340c13cc06dc32"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitsuba-renderer%2Fnanogui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitsuba-renderer%2Fnanogui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitsuba-renderer%2Fnanogui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitsuba-renderer%2Fnanogui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitsuba-renderer","download_url":"https://codeload.github.com/mitsuba-renderer/nanogui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190396,"owners_count":22029632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T04:01:07.120Z","updated_at":"2025-05-14T17:08:30.940Z","avatar_url":"https://github.com/mitsuba-renderer.png","language":"C++","funding_links":[],"categories":["GUI","C++"],"sub_categories":[],"readme":"NanoGUI\n========================================================================================\n|docs| |gha|\n\n.. |docs| image:: https://readthedocs.org/projects/nanogui/badge/?version=latest\n    :target: http://nanogui.readthedocs.org/en/latest/?badge=latest\n    :alt: Docs\n\n.. |gha| image:: https://github.com/mitsuba-renderer/nanogui/actions/workflows/build.yml/badge.svg\n   :target: https://github.com/mitsuba-renderer/nanogui/actions/workflows/build.yml\n   :alt: GitHub Actions Build Status\n\n.. begin_brief_description\n\nNanoGUI is a minimalistic cross-platform widget library for OpenGL 3+, GLES\n2/3, and Metal. It supports automatic layout generation, stateful C++ lambdas\ncallbacks, a variety of useful widget types and Retina-capable rendering on\nApple devices thanks to NanoVG_ by Mikko Mononen. Python bindings of all\nfunctionality are provided using nanobind_. Binary wheels of NanoGUI are\navailable on PyPI_.\n\n**Note**: This repository contains an improved port of the original NanoGUI_.\nThe most visible change to developers is that it no longer relies on Eigen or\nEnoki and ships with its own (absolutely minimal) vector library. Additionally,\nthe the repository here incorporates the following changes:\n\n1. A different set of naming conventions is used for function and variable\n   names that feels more natural in a mixed C++ \u0026 Python environment.\n   (specifically, ``underscore_case`` for methods and variables rather than\n   ``camelCase``).\n\n2. GUI Rendering now provides backends for OpenGL 3+, GLES 2/3, and Metal. GLES\n   2 support allows NanoGUI to run on ARM devices including the Raspberry Pi\n   and in browsers via WebGL. The Metal backend supports modern Macs, iPhones,\n   etc.\n\n   NanoGUI includes generic wrappers around shaders and textures that work for\n   all of these frameworks.\n\n3. The event loop is much more conservative by default and only issues redraw\n   calls when explicitly requested by an event callback.\n\n4. Python integration: the library comes with a ``pip``-compatible ``setup.py``\n   installation script.\n\n5. WebAssembly code generation works out of the box (requires Emscripten),\n   enabling powerful UI development for the web. See Tekari_ for an example of\n   such an application.\n\n6. Significantly revamped tab widget (supports right-click context menus,\n   draggable, and closeable tabs) and image view widget.\n\n7. The Entypo_ icon font has been replaced by FontAwesome_ (v5.10.1).\n\n.. _NanoVG: https://github.com/memononen/NanoVG\n.. _nanobind: https://github.com/wjakob/nanobind\n.. _PyPi: https://pypi.org/project/nanogui\n.. _NanoGUI: https://github.com/wjakob/nanogui\n.. _Tekari: https://rgl.epfl.ch/tekari?url=%2F%2Frgl.s3.eu-central-1.amazonaws.com%2Fmedia%2Fuploads%2Fwjakob%2F2018%2F08%2F27%2Firidescent-paper.txt\u0026log=1\n.. _Entypo: http://www.entypo.com\n.. _FontAwesome: https://github.com/FortAwesome/Font-Awesome\n\n.. end_brief_description\n\n- `Documentation \u003chttps://nanogui.readthedocs.io\u003e`_\n\n.. contents:: Contents\n   :local:\n   :backlinks: none\n\nExample screenshot\n----------------------------------------------------------------------------------------\n\n.. image:: https://github.com/wjakob/nanogui/raw/master/resources/screenshot.png\n   :alt: Screenshot of Example 1.\n   :align: center\n\nDescription\n----------------------------------------------------------------------------------------\n\n.. begin_long_description\n\nNanoGUI builds on GLFW_ for cross-platform context creation and event handling,\nGLAD_ to access OpenGL functionality on Windows, and NanoVG_/MetalNanoVG_ to\ndraw 2D primitives.\n\nNote that the dependency library NanoVG already includes some basic example code to draw\ngood-looking static widgets; what NanoGUI does is to flesh it out into a complete GUI\ntoolkit with event handling, layout generation, etc.\n\nNanoGUI currently works on Mac OS X (Clang), Linux (GCC or Clang), FreeBSD (Clang), and\nWindows (Visual Studio ≥ 2017); it requires a recent C++17 capable compiler. All\ndependencies are jointly built using a CMake-based build system.\n\n.. _GLFW: http://www.glfw.org/\n.. _GLAD: https://github.com/Dav1dde/glad\n.. _MetalNanoVG: https://github.com/ollix/MetalNanoVG\n\n.. end_long_description\n\nCreating widgets\n----------------------------------------------------------------------------------------\n\nNanoGUI makes it easy to instantiate widgets, set layout constraints, and\nregister event callbacks using high-level C++17 code. For instance, the\nfollowing two lines from the included example application add a new button to\nan existing window `window` and register an event callback.\n\n.. code-block:: cpp\n\n   Button *b = new Button(window, \"Plain button\");\n   b-\u003eset_callback([] { cout \u003c\u003c \"pushed!\" \u003c\u003c endl; });\n\n\nThe following lines from the example application create the coupled\nslider and text box on the bottom of the second window (see the screenshot).\n\n.. code-block:: cpp\n\n   /* Create an empty panel with a horizontal layout */\n   Widget *panel = new Widget(window);\n   panel-\u003eset_layout(new BoxLayout(BoxLayout::Horizontal, BoxLayout::Middle, 0, 20));\n\n   /* Add a slider and set defaults */\n   Slider *slider = new Slider(panel);\n   slider-\u003eset_value(0.5f);\n   slider-\u003eset_fixed_width(80);\n\n   /* Add a textbox and set defaults */\n   TextBox *tb = new TextBox(panel);\n   tb-\u003eset_fixed_size(Vector2i(60, 25));\n   tb-\u003eset_value(\"50\");\n   tb-\u003eset_units(\"%\");\n\n   /* Propagate slider changes to the text box */\n   slider-\u003eset_callback([tb](float value) {\n       tb-\u003eset_value(std::to_string((int) (value * 100)));\n   });\n\n\nThe Python version of this same piece of code looks like this:\n\n.. code-block:: py\n\n   # Create an empty panel with a horizontal layout\n   panel = Widget(window)\n   panel.set_layout(BoxLayout(BoxLayout.Horizontal, BoxLayout.Middle, 0, 20))\n\n   # Add a slider and set defaults\n   slider = Slider(panel)\n   slider.set_value(0.5)\n   slider.set_fixed_width(80)\n\n   # Add a textbox and set defaults\n   tb = TextBox(panel)\n   tb.set_fixed_size(Vector2i(60, 25))\n   tb.set_value(\"50\")\n   tb.set_units(\"%\")\n\n   # Propagate slider changes to the text box\n   def cb(value):\n       tb.set_value(\"%i\" % int(value * 100))\n   slider.set_callback(cb)\n\n\"Simple mode\"\n----------------------------------------------------------------------------------------\n\nChristian Schüller contributed a convenience class that makes it possible to\ncreate AntTweakBar-style variable manipulators using just a few lines of code.\nFor instance, the source code below was used to create the following example\napplication.\n\n.. image:: https://github.com/wjakob/nanogui/raw/master/resources/screenshot2.png\n   :alt: Screenshot\n   :align: center\n\n\n.. code-block:: cpp\n\n   /// dvar, bvar, strvar, etc. are double/bool/string/.. variables\n\n   FormHelper *gui = new FormHelper(screen);\n   ref\u003cWindow\u003e window = gui-\u003eadd_window(Vector2i(10, 10), \"Form helper example\");\n   gui-\u003eadd_group(\"Basic types\");\n   gui-\u003eadd_variable(\"bool\", bvar);\n   gui-\u003eadd_variable(\"string\", strvar);\n\n   gui-\u003eadd_group(\"Validating fields\");\n   gui-\u003eadd_variable(\"int\", ivar);\n   gui-\u003eadd_variable(\"float\", fvar);\n   gui-\u003eadd_variable(\"double\", dvar);\n\n   gui-\u003eadd_group(\"Complex types\");\n   gui-\u003eadd_variable(\"Enumeration\", enumval, enabled)\n      -\u003esetItems({\"Item 1\", \"Item 2\", \"Item 3\"});\n   gui-\u003eadd_variable(\"Color\", colval);\n\n   gui-\u003eadd_group(\"Other widgets\");\n   gui-\u003eadd_button(\"A button\", [](){ std::cout \u003c\u003c \"Button pressed.\" \u003c\u003c std::endl; });\n\n   screen-\u003eset_visible(true);\n   screen-\u003eperform_layout();\n   window-\u003ecenter();\n\nCompiling\n----------------------------------------------------------------------------------------\n\nClone the repository and all dependencies (with ``git clone --recursive``),\nrun CMake to generate Makefiles or CMake/Visual Studio project files, and\nthe rest should just work automatically.\n\nOn Debian/Ubuntu, make sure that you have installed the following packages\n\n.. code-block:: bash\n\n   $ apt-get install cmake xorg-dev libglu1-mesa-dev\n\nTo also get the Python bindings, you'll need to run\n\n.. code-block:: bash\n\n   $ apt-get install python-dev\n\nOn RedHat/Fedora, make sure that you have installed the following packages\n\n.. code-block:: bash\n\n   $ sudo dnf install cmake mesa-libGLU-devel libXi-devel libXcursor-devel libXinerama-devel libXrandr-devel xorg-x11-server-devel\n\nTo also get the Python bindings, you'll need to run\n\n.. code-block:: bash\n\n   $ sudo dnf install python3-devel\n\nLicense\n----------------------------------------------------------------------------------------\n\n.. begin_license\n\nNanoGUI is provided under a BSD-style license that can be found in the LICENSE_\nfile. By using, distributing, or contributing to this project, you agree to the\nterms and conditions of this license.\n\n.. _LICENSE: https://github.com/wjakob/nanogui/blob/master/LICENSE.txt\n\nNote that NanoGUI ships with several fonts that use different (though similarly\nunencumbered) licenses, in particular `Roboto\n\u003chttps://github.com/google/roboto/\u003e`_, `Inconsolata\n\u003chttps://github.com/googlefonts/Inconsolata\u003e`_, and the free version of the\n`Font Awesome icon font \u003chttps://github.com/FortAwesome/Font-Awesome\u003e`_\n(v5.10.1). The latter two are distributed under the `SIL Open Font License\nVersion 1.1 \u003chttps://opensource.org/licenses/OFL-1.1\u003e`_, while Roboto is\ndistributed under the `Apache 2.0\n\u003chttps://opensource.org/licenses/Apache-2.0\u003e`_ license.\n\n.. end_license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitsuba-renderer%2Fnanogui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitsuba-renderer%2Fnanogui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitsuba-renderer%2Fnanogui/lists"}