2024-04-09 13:35:43 +02:00
|
|
|
# NanoGUI Experiments
|
2024-04-09 10:55:27 +02:00
|
|
|
|
2024-04-09 13:35:43 +02:00
|
|
|
![NanoGUI Knobs example app](nanogui_knobs.png)
|
|
|
|
|
2024-04-10 18:14:00 +02:00
|
|
|
## Building
|
|
|
|
|
|
|
|
### Python
|
|
|
|
|
|
|
|
Set up virtual environment providing nanogui Python bindings:
|
2024-04-09 13:35:43 +02:00
|
|
|
|
|
|
|
```con
|
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
(venv) pip install -r requirenments.txt
|
2024-04-10 18:14:00 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Run helloworld examples:
|
|
|
|
|
|
|
|
```con
|
2024-04-09 13:35:43 +02:00
|
|
|
(venv) python3 nanogui_helloworld.py
|
2024-04-10 18:14:00 +02:00
|
|
|
(venv) python3 nanogui_custowidget.py
|
|
|
|
```
|
|
|
|
|
|
|
|
### C++
|
|
|
|
|
|
|
|
Configure build with *CMake*:
|
|
|
|
|
|
|
|
```con
|
|
|
|
cmake -B build -S .
|
|
|
|
```
|
|
|
|
|
|
|
|
(This will checkout the NanoGUI library from GitHub into the build directory.
|
|
|
|
You can use `-DNANOGUI_REPO=<repo path or URL>` to change from where Git will
|
|
|
|
retrieve the repository.)
|
|
|
|
|
|
|
|
Build the examples:
|
|
|
|
|
|
|
|
```con
|
|
|
|
cmake --build build
|
|
|
|
```
|
|
|
|
|
|
|
|
Run hellworld example:
|
|
|
|
|
|
|
|
```con
|
|
|
|
./build/nanogui_helloworld
|
2024-04-09 13:35:43 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Knobs Example
|
|
|
|
|
2024-04-10 18:14:00 +02:00
|
|
|
|
|
|
|
### Python
|
|
|
|
|
2024-04-09 13:35:43 +02:00
|
|
|
```con
|
|
|
|
(venv) python3 nanogui_knobs.py
|
|
|
|
```
|
|
|
|
|
2024-04-10 18:14:00 +02:00
|
|
|
|
|
|
|
### C++
|
|
|
|
|
|
|
|
```con
|
|
|
|
./build/nanogui_knobs
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2024-04-09 13:35:43 +02:00
|
|
|
### Key and Mouse Bindings
|
|
|
|
|
|
|
|
| | | |
|
|
|
|
| ----------------------------------------- | -------------------- |------------------------ |
|
|
|
|
| Mouse click-and-drag knob | coarse in-/decrement | +/- one 100th / pixel |
|
|
|
|
| Shift + mouse click-and-drag knob | fine in-/decrement | +/- 0.1 / pixel |
|
|
|
|
| Mouse wheel scroll over knob | coarse in-/decrement | one 100th / click * 2.0 |
|
|
|
|
| Shift + mouse wheel scroll over knob | fine in-/decrement | +/- 0.1 / click |
|
|
|
|
| Ctrl + left click on knob | set to default value | |
|
|
|
|
| Up/down key while mouse over knob | coarse in-/decrement | +/- one 100th |
|
|
|
|
| Shift + up/down key while mouse over knob | fine in-/decrement | +/- 0.1 |
|
|
|
|
| Page up/down key while mouse over knob | big in-/decrement | +/- one 10th |
|
|
|
|
| Mouse click on value entry up/down arrow | fine in-/decrement | +/- 0.1 |
|
|
|
|
| Mouse wheel scroll over value entry | fine in-/decrement | +/- 0.1 / click |
|
|
|
|
| Return/Enter while editing value entry | accept & set value | |
|
|
|
|
| Escape key | quit | |
|
|
|
|
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
|
|
* No support for scaling or re-layouting on window resize yet.
|
|
|
|
* Only the knob value gauge color can currently be specified on instantation,
|
|
|
|
the knob gradient and outline colors are currently hard-coded.
|