Skip to content

Conversation

@palszasz
Copy link

@palszasz palszasz commented Jun 9, 2025

These are some of the changes/patches we created on top of NanoGUI internally, and we thought it might be useful to contribute upstream.

Please let me know if you don't want some parts, or wants something rewritten. Also I could split it in smaller PRs, I just uploaded them in a batch to have an overview of the changes. So please treat this PR more like a request-for-comment :-)

palszasz and others added 15 commits April 28, 2025 14:07
I think this was created by IntelliSense in Visual Studio Code.
Add a child widget (a label) to an ImageView instance, demonstrating
that it will render on top of the image content.
I don't remember which version of macOS had this issue, and cannot
reproduce it on latest (15.4.1), but some older macOS versions probably
still have this issue.

The only downside of this change could be that the default text is not
localized.
With this patch now even simple plain float vertex attributes are
supported as well.
nanogui::async schedules a function to be executed in the next main loop
iteration. It’s doing it by appending the function to a list of
functions, while holding a lock (for thread safety).

In the UI thread nanogui will process each of these functions one by
one, while holding the same lock. This means that while it’s executing
an async function, any thread calling `async` will be blocked, which can
easily lead to deadlocks.

To fix this, in the UI thread the lock is held only until the functions
are moved to a temporary storage. This way when the functions are
executed, async can still be called (and the function will be executed
in the *next* main loop iteration)
* Added “flat” attribute: if set, the button background and outline is
  not rendered (except the outline is rendered when the mouse is
  hovering above it). This can be used to remove UI clutter.
* Added attributes for the button padding. This allows to create more
  compact buttons, without setting a fixed size.
* Note that the new attributes should not increase sizeof(Button), since
  they were inserted in wasted space due to alignment (and that’s one
  reason why the padding is stored in 8-bit: it’s still big enough, but
  we don’t waste additional space... assuming bool is one byte)
The example1 was running out of window space. Created example5 to
continue demonstrating other widgets.
Before popup windows always popped up at the side of the parent window.
This worked for smaller windows, but in case the window was too big (a
common example is if the window covers the whole screen), the popup was
shown outside of the screen.

This patch adds two extra constants: LeftInside and RightInside.
If these constants are used (instead of Left and Right), the popup will
be shown next to the widget, and not next to the parent window.
For example, if a popup should pop up to the right of a widget, but the
widget is already at the right edge of the screen, the popup would be
invisible. With this fix, the popup is moved back into visible screen
area.
This will allow easier re-use with other components
@wjakob wjakob force-pushed the master branch 9 times, most recently from 654b8a5 to 1cbff2e Compare August 29, 2025 18:29
@wjakob wjakob force-pushed the master branch 6 times, most recently from 21626d0 to d368a4f Compare September 1, 2025 15:39
@wjakob wjakob force-pushed the master branch 19 times, most recently from c75898b to 1bbd038 Compare September 6, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants